Research shows that 41% of consumers prefer live chat for customer support but powering this kind of service is difficult, especially scaling it across the globe and maintaining reliability. HubSpot, a SaaS CRM platform, uses Ably and the publisher/subscriber pattern it supports to send 80,000 messages per day.
Notifications – whether they’re about an event on the weekend or about a tool at work – depend on realtime delivery. The longer notifications take to reach an end-user, the more their value decays. Split, a feature delivery platform, uses Ably to publish feature flag update notifications across more than one trillion events per month so that subscribers can stay up-to-date on essential changes.
Similar to notifications, realtime updates also degrade rapidly with time. For sports fans, for example, a realtime application that keeps track of a game’s score can be compelling and exciting, whereas an application that promises the same but delivers updates minutes after a score is made is disappointing. Tennis Australia, the company that manages the Australian Open, uses Ably to broadcast live updates throughout its widely watched matches. During the 2022 tournament, Tennis Australia used Ably to send over nine billion messages to over one million users.
In the event streaming pattern, an implementation of the publisher/subscriber pattern, subscribers and publishers remain decoupled and messages still flow between them via a broker. But with event streaming, subscribers can read events from any point in the event stream and events can persist after they’re processed.
IoT devices are frequently deployed to monitor environmental changes and send information back to a hub for analysis. Logistics companies, for example, might use IoT devices to monitor weather changes that could affect sensitive packages. By using an event streaming pattern, these companies can monitor changes in realtime and if a package arrives damaged, re-examine previous changes to see what might have caused it.
Ecommerce companies lose as much as $48 billion a year to fraud, so it benefits them to find ways to track fraud risks and respond to them as quickly as possible. With event streaming, ecommerce companies can monitor risky shopping behavior and analyze how successful their fraud detection policies are by reviewing previous events.
Traders monitoring stock prices care as much about the retrospective flow of data as the realtime flow. While the realtime flow is essential for making rapid decisions in a similarly rapid market, traders also need to look at previous events to see patterns that can fuel future predictions.
The key benefit of EDA is that it enables clients to subscribe to events and receive updates asynchronously, but if both the client and the event in question are online at the same time, the client can then receive event updates in realtime. The benefits below all flow from that design.
With EDA, businesses can:
Create fluid, realtime experiences. Because EDA shifts complexity to event producers instead of clients, companies can provide effective, instantaneous-feeling realtime experiences.
Build flexible systems. EDA decouples event producers and consumers, which means that companies can separate communication logic and business logic. Given that separation, companies can change and iterate different parts of the system without breaking other parts.
Deliver messages across devices and platforms. Because EDA uses a broker, publishers and subscribers don’t directly communicate, which means that the broker can push messages to a variety of subscribers across a wide range of devices and platforms.
Maintain elasticity. With EDA, business logic doesn’t depend on there being a particular amount of publishers and subscribers. Given that decoupling, EDA systems can accommodate surges in users without failure or latency.
Increase responsiveness. Because EDA enables asynchronous communication, development teams can program modules separately – all the while knowing that message delivery won’t block the event producers. After message delivery, the event producer returns to its regular work and messages only interrupt subscribers when the message corresponds to a subscribed topic.
Despite its clear advantages over response/request architecture in many contexts, EDA isn’t suitable in every context. Even when companies build EDA for the right reason and use case, issues like scalability, reliability, and latency can make EDA less effective than it can be.
Excessive complexity. EDA is a rigorous architecture design appropriate for rigorous circumstances. For simple systems and use cases, EDA can be overkill. If static scaling will suffice, for example, a traditional system is likely a better fit.
Poor fit for media streaming. Both publisher/subscriber and event streaming patterns (despite the name of the latter) are poor models for streaming audio and video content. Media streaming has its own nuanced requirements and systems that provide synchronous point-to-point communication will be more effective.
Overkill for periodic tasks. EDA is well-suited to asynchronously processing and sending information, so it’s not the best solution for processes that run regular or periodic background tasks. For running regular cron jobs, for example, EDA will be overkill.
Implementation difficulties. EDA, like realtime updates infrastructure more broadly, lives and dies by how well companies implement it. At its best, EDA helps applications deliver and react to event changes in realtime, but if there are even small issues with scalability, reliability, and latency, the otherwise compelling benefits can evaporate.
Read more about the EDA challenges and how to overcome them.
In an effective event-driven system, the details – particularly as the system scales – make all the difference. Complexity, both from edge cases and from the sheer density of producers, events, and subscribers will chase any EDA project.
As you build, consider these questions:
How can you maintain consistently low latencies, especially as you scale?
How can you increase bandwidth performance?
How can you preserve data integrity and ensure messages are accurate and delivered without repetition and in the correct order?
How can you ensure your system consistently remains highly available?
How can you build a system that is reliable and fault tolerant?
Answering these questions and addressing the challenges they pose involves a range of best practices, including:
Build for horizontal scalability so that adding components doesn’t require downtime.
Choose products and frameworks that support clustering across different regions so that each component remains highly available.
Choose components that you can separate so that each one is independently scalable and can contribute to greater overall resiliency.
Build a strategy for exception handling so that your system can log exceptions, retry processing an event a specified amount of times, and move the non-working event to a separate queue.
Prioritize security so that your system can maintain transport level security, authorize and control access to events, provide audit trails, and encrypt data.
Many companies can see the benefits of EDA – as well as the benefits of systems EDA can support, such as realtime updates – but not all of them have the resources, time, or niche development skills to build an event-driven system. Especially when you account for the challenges and best practices above, it often makes sense to turn to a provider who specializes in this work.
Ably provides a realtime PaaS that includes APIs and SDKs that developers can use to build and ship realtime features without having to build realtime infrastructure or event-driven systems from scratch. With Ably, companies can depend on publisher/subscriber messaging over wireless WebSockets, multiple protocol capabilities, managed integrations with tools like Kafka, a globally distributed network, and < 65ms round-trip latency.
Max Freiert, Product Group Lead at Hubspot, told us that “Ably makes realtime just work – without it, our product would literally stop working.” At Hubspot, Freiert says, “Ably is now a business-critical part of our organization-wide infrastructure and a key innovation partner that our engineers really like working with.”
Five key benefits of event-driven architecture and the use cases that make some companies particularly suited to EDA.
Event-driven architecture (EDA) is a complex solution to a complex problem. Here, we cover a few of EDAs biggest challenges and how to manage with them.
Discover the two major patterns for event-driven architectures and the use cases for each, complete with examples.