A Guide to Event-Driven Architecture Pros and Cons
By Meshvi Patel
Event-driven architecture is a hot topic amongst enterprise architects and software developers these days. But when it comes to the pros and cons of event-driven architecture, not everyone has made up their mind on what they think.
Event-driven architecture is defined as an architectural style where decoupled applications, microservices, and IoT devices can asynchronously exchange events as they occur via an event broker. It requires building IT systems such that they can sense/detect business events as they occur (e.g., an order placed, a payment received, inventory updated, an order shipped, etc.) and distribute them in real-time to all interested parties/systems to help make time-critical informed decisions.
A global survey about event-driven architecture from 2021 showed that 72% of respondents believe that the benefits of event-driven architecture outweigh the costs, or at least equal them. Read on to see if you agree.
For more on what event-driven architecture is and the answers to some frequently asked questions, visit this page dedicated to understanding event-driven architecture and the related tools and concepts.
What are the advantages of event-driven architecture?
Agility, reliability, availability, and scalability are core attributes of any high-performance enterprise architecture. Common advantages of event-driven architecture include:
- Loose coupling / decoupling of producers and consumers
- Superior fault tolerance
- Fan out and less technical debt
Below is an analysis of the three advantages to event-driven architecture and how each relates to the essential traits of performant enterprise architectural design.
Loose Coupling / Decoupling of Producers and Consumers
In event-driven architecture, producers and consumers of events are decoupled. That is, the producer of the event does not need to know who the consumer is, and the consumer need not know who the producer is. Since events are processed asynchronously as they occur and there is no dependency on other services, the response times are much higher. There is no blocking on waiting for responses as with synchronous calls.
The independent and autonomous nature of decoupled producers and consumers also reduces the risk of changing one without necessitating a change to others. This gives greater flexibility and agility to bring new functionality faster to the market. It also makes the architecture highly scalable and extensible.
Fault Tolerance
Decoupled services also means if one service fails, it does not cause others to fail. The event broker, a key component of event-driven architecture, is a stateful intermediary that acts as a buffer, storing events and delivering them when the service comes back online. Because of this, service instances can be quickly added to scale because it doesn’t result in downtime for the whole system — thus, availability and scalability are improved.
Fan Out and Less Technical Debt
Event-driven architecture is push-based, so if multiple downstream systems need to act based on the occurrence of the event, then the event can be fanned out to these systems in parallel without the need for custom code. This also saves the downstream systems from continuous polling to check for an event occurrence, resulting in less resource utilization in terms of network bandwidth, CPU, etc.
What are the disadvantages of event-driven architecture?
Building applications with event driven architecture can be a great way to tie internal features together and make them more responsive. However, not everyone has embarked on their event-driven journey due to some perceived challenges. Three commonly quoted disadvantages of event-driven architecture are:
- Increased complexity
- Debugging and troubleshooting challenges
- Difficulties with monitoring
Added Complexity
Developers perceive event-driven architecture to be inherently complex. With too many events, producers and consumers associated with different business processes and workflows can be daunting to manage. How do you lifecycle manage your events? How do you discover existing events? How do you generate code without an “event” contract?
Debugging and Troubleshooting Challenges
With the distributed and decoupled nature of event driven applications, it can be hard to trace an event from source to destination. This can result in testing and debugging challenges and an increase in resources and time for root-cause analysis.
Difficulties with Monitoring
Monitoring distributed, highly decoupled applications and systems can be trickier. Since the services are independent of each other, you need a proper design to understand how they interact with each other and also a proper alerting mechanism to understand the knock-on effect should a service fail.
Overcoming the Challenges
Fortunately, with the right tools on hand the challenges discussed in the previous section can be overcome. Here are some tools that you can look into to make event-driven architecture an easier sell within your organization:
The other challenge that comes with event-driven architecture is on the business end. Almost 40% of businesses believe that educating the rest of the company (especially those in less technical roles) on the benefits of event-driven architecture is a major hurdle that prevents them from moving forward. While survey respondents also cited the lack of adequate talent as an issue, they agreed that the gap between tech and leadership buy-in as well as cost are the least worrisome challenges when it comes it implementing event-driven architecture. Read stats regarding other business challenges.
When should you use event-driven architecture?
Event-driven architecture is not a new concept; it has been around for decades, but has been gaining popularity with many modern use cases and IT leaders around the globe touting its effectiveness. Different organizations have evaluated the pros and cons of event-driven architecture and use it to solve modern business problems and achieve better results in critical decision making, operational efficiency, integration of environments, and innovation.
- Critical Decision Making: Real-time situational awareness and responsiveness is important for better decision-making in critical situations, like stopping a faulty production line in manufacturing or reducing time to treatment to improve patient outcomes in healthcare systems.
- Operational Efficiency: Parallel processing where multiple processes need to execute asynchronously off a triggered event.
- Integration of heterogeneous environments: A network of event brokers (event mesh) can be used to dynamically route events from a variety of locations (on premises, cloud, IoT) across connected applications and devices.
- Innovation: Agility to add new functionality without impacting existing interfaces gives the flexibility to innovate rapidly.
Event-driven architecture can make it easier to build applications that run across different types of platforms. And it is a simple and powerful way to employ decoupling, which can help with scaling systems and building resilient systems. The real-time insights enable businesses to be innovators and leaders, like these examples of businesses that use event-driven architecture.
Conclusion
As you have read, there are a few pros and cons to consider when it comes to event-driven architecture, but it is a powerful way to build applications that run across different types of platforms. It’s not a silver bullet or a one-size-fits all solution, but the many successful implementations, (along with 71% of survey respondents) point to the advantages outweighing the disadvantages.
Originally published at https://solace.com on October 31, 2022.