API / Microservices Design Patterns Interview Questions
What is the Event-Driven Architecture pattern and how does it differ from synchronous request/response?
Event-Driven Architecture (EDA) structures communication around events — immutable records of something that has happened. A producer emits an event to a broker and moves on without knowing or caring who consumes it. Consumers subscribe to events and react asynchronously and independently. No party waits for another.
In synchronous request/response, the caller blocks until the called service returns a result. This creates three forms of coupling:
- Temporal coupling — caller and callee must both be alive at the same instant.
- Behavioural coupling — the caller depends on the callee's response structure and error codes.
- Performance coupling — the caller's response time is bounded below by the callee's processing time.
EDA eliminates all three. The producer has no knowledge of its consumers; a new consumer can subscribe to existing events without any producer code change. The system can scale consumer instances independently, and a slow consumer does not delay the producer.
Trade-offs of EDA:
- Eventual consistency — consumers process events asynchronously; the system is not instantly consistent after an event is published.
- Harder debugging — end-to-end request flows are reconstructed by correlating events across distributed logs rather than reading a single call stack.
- Event schema evolution — changing an event's schema is a breaking change for all consumers; requires careful versioning (additive changes only, or explicit versioned event types).
- No immediate response — EDA is unsuitable for interactions that require a synchronous return value (e.g., a login that must return a JWT).
EDA and request/response often coexist in the same system: synchronous for user-facing read operations that need immediate results; asynchronous events for state change propagation across service boundaries.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
