API / Microservices Design Patterns Interview Questions
What is the difference between Choreography-based and Orchestration-based Sagas?
Both styles implement the Saga pattern (Q10) but differ fundamentally in how the steps are coordinated. In Choreography, there is no central authority: each service listens for domain events published by the preceding step and reacts autonomously, emitting its own event to trigger the next participant. In Orchestration, a dedicated Saga orchestrator sends explicit commands to each participant and receives success/failure responses, driving the workflow from a single place.
| Aspect | Choreography | Orchestration |
|---|---|---|
| Coordination | Implicit via domain events on a message broker | Explicit commands from a central orchestrator |
| Coupling | Services are coupled to event topics, not to each other | Orchestrator is coupled to each participant service |
| Visibility | Flow is distributed across services; hard to visualise end-to-end | Entire saga flow is explicit in the orchestrator's state machine |
| Debugging | Requires correlating events across multiple logs and services | Orchestrator state shows exact step and failure point |
| Scalability | Good — no central bottleneck | Orchestrator can become a bottleneck at very high throughput |
| Best for | Simple 2–3 step sagas; teams that already use event-driven patterns | Complex multi-step sagas with many compensations and error paths |
Choreography example — OrderService emits OrderCreated; InventoryService listens and emits StockReserved; PaymentService listens and emits PaymentProcessed; OrderService listens and marks the order confirmed. No single component knows the full flow.
Orchestration example (using AWS Step Functions or Temporal):
OrderSagaOrchestrator: 1. send ReserveStockCommand â InventoryService 2. on StockReserved: send ChargePaymentCommand â PaymentService 3. on PaymentProcessed: send ConfirmOrderCommand â OrderService 4. on PaymentFailed: send ReleaseStockCommand â InventoryService (compensate)
More Related questions...