The saga pattern for system design interviews, explained
Design an order checkout across microservices — reserve inventory, charge the card, create the shipment — and you hit the hardest problem in distributed systems: those three steps live in three services with three databases, and you need them to happen all-or-nothing, but there is no single transaction that spans them. The textbook answer is two-phase commit, and the interview answer is why you don't use it. The saga pattern is what you use instead: instead of one atomic transaction, you run a sequence of local transactions, one per service, and if any step fails you run compensating transactions to undo the ones that already succeeded. It is a core system design interview concept because distributed transactions are unavoidable in microservices, 2PC does not scale, and a saga trades strict atomicity for something you can actually run at scale — at the cost of complexity the follow-ups go straight for.
The reason it comes up is that the moment you split a monolith into services with separate databases, you lose the free ACID transaction that used to wrap a multi-step operation, and you have to rebuild consistency by hand. A saga does that by making each step a local, committed transaction and defining, for each one, how to compensate — semantically undo it — if a later step fails. There is no global rollback; there is a forward path and a backward, undo path. This guide walks what a strong candidate names out loud: why 2PC doesn't scale, what a saga is (local transactions plus compensations), choreography vs orchestration, and the pitfalls — no isolation, idempotency, and failed compensations — that the interview is really about.
Why the saga pattern comes up in system design interviews
The saga rarely gets its own prompt. It appears inside a microservices design — an order system, a payment flow, a travel booking — the moment the interviewer asks how a multi-step operation stays consistent when each step is in a different service. You say "I'll use a distributed transaction," and the follow-up is the trap: across separate databases and third-party APIs, a two-phase commit holds locks, blocks, and often is not even supported — so how do you keep the system consistent without it? The saga is a favourite probe because "I'll make it transactional" is the easy half, and designing the compensations and handling the no-isolation problem is where real distributed-systems understanding shows.
The interviewer rarely lets "wrap the whole thing in a transaction" stand on its own. "Inventory is reserved, the payment succeeds, and then creating the shipment fails. There's no database to roll back — those commits already happened in three different services. Walk me through exactly how you leave the system consistent." That question — undoing committed work across services without a global rollback — is the one a memorised "use a saga" answer can never survive.
The rounds on Zynter are modelled on how the loop runs, not scraped from any candidate's recall. What matters for prep is the shape: you name the saga, and the next sentence attacks a failed compensation, a duplicate message, or the inconsistent intermediate state another transaction can see.
What the interviewer is really testing
A saga answer is read on the same four dimensions as any design decision. Problem solving — did you reach for a saga because 2PC doesn't scale, and define the compensations, or just say "transaction"? Communication — can you say in one sentence why a saga has no rollback, only compensation? Technical execution — do you make steps and compensations idempotent, handle the no-isolation problem, and choose choreography vs orchestration? Time management — did you spend your words on the failure and compensation story, not on naming a saga library? Reading this guide teaches the concept; it does not teach you to defend a compensation while someone fails a step mid-flow.
The problem: distributed transactions and why 2PC doesn't scale
Start with why this is hard, because the saga only makes sense against the alternative. In a monolith, a multi-step operation is one ACID transaction: if any step fails, the whole thing rolls back, and isolation hides the half-done state. Split into microservices, each with its own database, and that single transaction is gone — no database can roll back changes committed in another service.
The classic fix for distributed atomicity is two-phase commit (2PC): a coordinator asks every participant to prepare (do the work but hold it, keeping locks), and only if all say yes does it tell them to commit. It gives real atomicity, but it does not scale for microservices, and you must say why:
- It is blocking — participants hold locks across the whole prepare-and-wait window, so a slow or far-away participant stalls everyone and kills throughput.
- The coordinator is a single point of failure — if it dies after prepare but before commit, participants are stuck holding locks, unsure whether to commit or abort.
- It is often unsupported — third-party APIs (a payment provider, a shipping service) do not expose a prepare/commit protocol, so you cannot enlist them in a 2PC at all.
The sentence that scores: across separate databases there's no single transaction to roll back, and two-phase commit — the textbook distributed-atomicity answer — blocks on held locks, depends on a fragile coordinator, and isn't supported by external services, so it doesn't scale for microservices. A saga gives up strict atomicity and rebuilds consistency with compensations instead. Naming 2PC and why you reject it is what frames the saga as the right answer.
What a saga is: local transactions and compensations
A saga is a sequence of local transactions. Each step does its work in one service's database and commits immediately, then triggers the next step (by publishing an event or being called by a coordinator). There is no global lock and no global rollback — each step is already committed by the time the next runs. So the saga needs a different way to handle failure:
- Forward path (happy case): step 1 commits and triggers step 2, which commits and triggers step 3, and so on to the end. Reserve inventory → charge payment → create shipment → order confirmed.
- Backward path (a step fails): when a step fails, the saga runs a compensating transaction for each step that already succeeded, in reverse order, to semantically undo it. If creating the shipment fails, you refund the payment and release the inventory — you do not "roll back," because those transactions committed; you apply new transactions that reverse their effect.
The key idea to state: a compensating transaction is a semantic undo, not a rollback. You cannot un-commit a charge, so you issue a refund; you cannot un-reserve stock with a rollback, so you release it. Every forward step needs a defined compensation, and the saga is only as correct as those compensations are. The sentence that scores: a saga is local transactions chained forward, each committing in its own service; when one fails, it runs compensating transactions in reverse to semantically undo the committed steps — refund the charge, release the stock — because there's no global rollback to fall back on.
System Design
HLD · Core concept
Walk a saga's forward and compensation path out loud
Choreography vs orchestration sagas
Once you have steps and compensations, the design decision is who drives the sequence — and this is the comparison the interview turns on:
- Choreography — there is no central coordinator. Each service listens for events and reacts: the order service emits "order created," the payment service consumes it and emits "payment captured," the shipping service consumes that, and so on; failures emit failure events that trigger compensations. It is decentralised and loosely coupled, with no single bottleneck, but the end-to-end flow is implicit — spread across services and hard to see, debug, or change — and it risks cyclic dependencies as the flow grows.
- Orchestration — a central orchestrator (a saga execution coordinator) explicitly drives the steps: it calls each service in turn, waits for the result, and on a failure it invokes the compensations in reverse. The flow is centralised, visible, and controllable in one place — easy to monitor and reason about — but the orchestrator is a component every saga depends on, and it must itself be made reliable.
The sentence that scores: choreography wires services together with events and no coordinator — decoupled but the flow is implicit and hard to trace; orchestration puts a coordinator in charge of the sequence and the compensations — visible and easy to debug, at the cost of a central component. I'd reach for orchestration once the flow has more than a few steps, because the explicit control pays off in debuggability. Knowing when to pick each — short flows choreographed, complex flows orchestrated — is the judgment signal.
System Design
HLD · Core concept
Pick choreography vs orchestration and defend it out loud
The pitfalls: no isolation, idempotency, and failed compensations
A saga is not a free lunch, and naming its sharp edges is what separates a real answer from a diagram:
- No isolation (the big one). A saga gives you atomicity-via-compensation and durability, but it does not give you ACID's isolation: because each step commits immediately, its intermediate result is visible to other transactions before the saga finishes — so another transaction can read inventory that a saga is about to release, a "dirty read" of in-flight state. You handle it with semantic locks (mark a record "pending" so others know it is mid-saga), commutative updates (operations that are safe in any order), or a re-read / version check before acting. Naming the missing isolation, unprompted, is the single biggest tell.
- Idempotency. Steps and compensations run over at-least-once messaging and get retried, so each must be idempotent — processing a message twice must not charge twice or refund twice. Dedupe on an id or make the operation naturally repeatable.
- Compensations can fail. The undo step can itself fail (the refund service is down). You must retry compensations until they succeed (they are designed to be retriable), and sometimes escalate to a human or a dead-letter queue; a compensation that cannot complete is a stuck saga.
- No automatic rollback of everything. Because there is no global transaction, you are responsible for defining a correct compensation for every step and for the order they run in.
The point to state plainly: a saga buys scalable atomicity but loses isolation, so you add semantic locks or commutative operations; and because everything runs on retriable messaging, every step and compensation must be idempotent. Those two — no isolation and idempotency — are the follow-ups that decide the round.
How to talk about the saga pattern in an interview
The probes from every section rhyme. Master these five and you can defend a saga in any microservices design, not just this checklist.
- "Why not a distributed transaction (2PC)?" → It blocks on held locks, has a single-point-of-failure coordinator, and isn't supported by external APIs, so it doesn't scale for microservices; a saga rebuilds consistency with compensations instead. (problem solving)
- "A middle step fails after earlier ones committed — now what?" → Run compensating transactions in reverse to semantically undo the committed steps (refund the charge, release the stock); there's no rollback, only compensation. (technical execution)
- "Choreography or orchestration?" → Choreography (event-driven, no coordinator, decoupled but implicit) for short flows; orchestration (a central coordinator drives steps and compensations, visible and debuggable) for complex ones. (communication)
- "Another transaction reads data mid-saga — isn't that inconsistent?" → Yes — sagas lack isolation, so intermediate state is visible; you use semantic locks (mark records pending), commutative updates, or re-read/version checks to manage it. (problem solving)
- "A message is delivered twice, or a compensation fails?" → Steps and compensations must be idempotent for at-least-once delivery, and compensations are retried until they succeed, with escalation if they cannot. (technical execution)
Each maps to a debrief dimension. Reading them teaches the answers; it does not teach you to deliver them while someone fails a step mid-flow — that only comes from saying them out loud.
How to prepare: a short plan
You do not need a new topic for every design. You need the saga vocabulary automatic, so when a design needs a multi-service transaction you reach for the right structure without thinking.
- Day 1: Learn why 2PC doesn't scale and what a saga is — local transactions plus compensating transactions — until you can draw the forward and backward paths from memory.
- Day 2: Drill choreography vs orchestration and the pitfalls — the missing isolation (semantic locks), idempotency for at-least-once delivery, and retriable compensations. These are where the follow-ups live.
- Day 3: Place a saga inside a real design (an order checkout, a payment, a booking): define each step and its compensation, pick a coordination style, and name the no-isolation problem. Then do it out loud, timed, with someone failing a step mid-flow.
This explainer feeds the broader Top 25 system design interview questions — sagas show up in order systems, payments and bookings, so getting the pattern automatic pays off across the whole list.
Frequently asked questions
What is the saga pattern?
The saga pattern is a way to maintain data consistency across a business transaction that spans multiple microservices, each with its own database, without using a single distributed transaction. Instead of one atomic operation, a saga is a sequence of local transactions: each step does its work in one service and commits immediately, then triggers the next step. Because each step is already committed, there is no global rollback — so every step has an associated compensating transaction that semantically undoes its effect if a later step fails. If, say, payment succeeds but shipment creation fails, the saga runs the compensations in reverse (refund the payment, release the inventory) to return the system to a consistent state. It trades the strict atomicity and isolation of a single ACID transaction for something that scales across services.
Why not use two-phase commit instead of a saga?
Because two-phase commit does not scale for microservices. In 2PC a coordinator asks every participant to prepare and hold its changes (and its locks), then commits only if all agree — which gives real atomicity but is blocking: participants hold locks across the whole prepare-and-wait window, so a slow participant stalls everyone and throughput collapses. The coordinator is also a single point of failure: if it dies between prepare and commit, participants are stuck holding locks, unsure whether to proceed. And crucially, many services — especially third-party APIs like payment or shipping providers — do not expose a prepare/commit protocol at all, so they cannot be enlisted in a 2PC. A saga avoids all of this by letting each step commit locally and using compensating transactions instead of a global rollback.
What is the difference between choreography and orchestration sagas?
They are two ways to coordinate the saga's steps. In a choreography saga there is no central coordinator: each service listens for events and reacts by doing its local transaction and emitting its own event, so the overall flow emerges from the chain of events — it is decentralised and loosely coupled, but the end-to-end flow is implicit, spread across services, and hard to trace or change, and it can develop cyclic dependencies. In an orchestration saga a central orchestrator explicitly drives the sequence, calling each service in turn and invoking the compensating transactions in reverse on a failure, so the flow is centralised, visible and easy to debug, at the cost of a coordinator component that every saga depends on. Short flows are often choreographed; complex multi-step flows usually benefit from orchestration.
What are the main drawbacks of the saga pattern?
The biggest is the lack of isolation. A saga provides a form of atomicity (through compensation) and durability, but not ACID's isolation: because each step commits immediately, its intermediate result is visible to other transactions before the saga completes, so another transaction can read in-flight state — effectively a dirty read of data the saga might still compensate. You manage this with semantic locks (marking a record as pending), commutative updates, or re-reading and version-checking before acting. The other drawbacks are that every step and compensation must be idempotent because they run over at-least-once messaging and get retried, that compensating transactions can themselves fail and so must be retriable, and that you are responsible for defining a correct compensation for every step since there is no automatic global rollback.
How do I practise a system design interview out loud?
Reading about the saga pattern is not the same as defending a compensation while an interviewer fails a step mid-flow. On Zynter, the HLD track runs live voice rounds modelled on how real system design loops run — you talk through a design (like an order checkout or a payment flow) on a shared canvas, and a voice interviewer follows up one question at a time ("why not 2PC?", "a middle step fails — now what?", "another transaction reads the in-flight state"), then gives you a debrief on problem solving, communication, technical execution and time management. The score is a practice signal, not a hiring decision.
Practise it on Zynter
You can say "use a saga." The round is won on the compensations and the missing isolation.
Pick an HLD system design round with a multi-service transaction, lay out the saga on the canvas, and defend it out loud to a voice interviewer that keeps asking "why not two-phase commit?" and "payment succeeded, shipment failed — leave it consistent." — then read the debrief. Zynter.ai is on-demand mock interviews modelled on real company loops, with 150+ rounds across 20 companies including the HLD system design track (Sep 2026).
Practise an HLD system design round →
Browse all interview tracks




Top comments (0)