What is the difference between orchestration and choreography in sagas?
Compare orchestration and choreography in the Saga pattern: coordination, coupling, failure handling, examples and microservices interview answers.
Expected Interview Answer
In an orchestrated saga a single central coordinator explicitly tells each service what to do and in what order, while in a choreographed saga there is no coordinator — each service reacts to events published by others and decides its own next action.
Orchestration centralizes the workflow logic in one orchestrator that issues commands and tracks saga state, making the flow easy to visualize, monitor, and change but adding a component that every step depends on. Choreography distributes the logic: services emit and subscribe to events, giving loose coupling and no single bottleneck, but the overall flow becomes implicit and harder to trace as the number of services grows.
- Orchestration centralizes and clarifies complex workflows
- Orchestration simplifies monitoring and error handling
- Choreography avoids a central point of coupling
- Choreography scales well for simple, loosely coupled flows
- Choosing correctly reduces long-term maintenance cost
AI Mentor Explanation
Orchestration is a captain on the field signalling each fielder where to stand and when to bowl — one mind directing every move. Choreography is a well-drilled side where players read the game and reposition themselves off each other's cues without instructions. The captain's version is easy to follow and adjust; the instinctive version is fluid but harder for an outsider to trace who is reacting to whom.
Step-by-Step Explanation
Step 1
Identify the saga steps
List the local transactions across services that make up the distributed workflow.
Step 2
Decide who owns the flow
Choose orchestration if one component should own and sequence the workflow, or choreography if services should react to events independently.
Step 3
For orchestration, build a coordinator
Create an orchestrator that sends commands to each service, tracks saga state, and triggers compensations on failure.
Step 4
For choreography, define events
Have each service publish domain events and subscribe to the events that should trigger its own next local transaction.
Step 5
Handle failures per style
Orchestrator invokes compensations directly; in choreography, failure events cascade to trigger each service's compensating action.
Step 6
Add observability
Correlate steps with a saga id so the flow can be traced regardless of style, especially important for choreography.
What Interviewer Expects
- A clear definition of each coordination style
- The coupling and single-point-of-dependency trade-off
- How failures and compensation differ between the two
- When each style is the better fit
- Awareness that observability is harder in choreography
Common Mistakes
- Claiming one style is universally better than the other
- Confusing an orchestrator with an API gateway
- Assuming choreography needs no shared saga state or tracing
- Overusing choreography until the implicit flow becomes untraceable
- Forgetting that both styles still require compensating transactions
Best Answer (HR Friendly)
“Orchestration uses a central controller that tells each service what to do step by step, so the whole process is easy to see and manage. Choreography has no controller — services simply react to each other's events, which keeps them loosely connected but makes the overall flow harder to follow.”
Code Example
// Central orchestrator issues commands in order
async function orderOrchestrator(order) {
await commands.reserveInventory(order)
await commands.chargePayment(order)
await commands.dispatchShipment(order)
}// Inventory service reacts to an OrderCreated event
bus.on('OrderCreated', async (order) => {
await inventory.reserve(order)
bus.emit('InventoryReserved', order)
})
// Payment service reacts to InventoryReserved
bus.on('InventoryReserved', async (order) => {
await payment.charge(order)
bus.emit('PaymentCharged', order)
})Follow-up Questions
- When does choreography become hard to maintain?
- How do you monitor a choreographed saga end to end?
- Can you mix orchestration and choreography in one system?
- How does each style handle a compensating transaction?
- What role does a message broker play in choreography?
MCQ Practice
1. In an orchestrated saga, who decides the order of steps?
Orchestration centralizes control in a single orchestrator that commands each step in sequence.
2. A key advantage of choreography is that it:
Choreography lets services react to events without a coordinator, giving looser coupling and no central dependency.
3. A common drawback of choreography is that:
Because logic is spread across event reactions, the end-to-end flow is not centralized and is harder to follow.
Flash Cards
What is saga orchestration? — A central coordinator commands each service step by step and tracks the saga's state.
What is saga choreography? — Services react to each other's published events with no central coordinator.
Main trade-off? — Orchestration is easy to monitor but centralizes coupling; choreography is loosely coupled but harder to trace.
Which needs a message broker most? — Choreography relies on an event bus/broker so services can publish and subscribe to events.