Saga pattern explained in plain terms means understanding how a business process that spans several services can stay consistent, even though no single transaction can cover them all. The central question is what happens when an order is placed, a payment is taken, and stock is reserved by three different services, and one of them fails, and the answer is a saga: a chain of steps, each with a matching undo step, so the whole process can be rolled back cleanly.
A saga is a pattern for managing a long-lived transaction across microservices, breaking it into a sequence of local transactions, one per service, with a compensating transaction defined for each step. If a step fails, the saga runs the compensating actions for the steps that already succeeded, in reverse order, leaving the system in a consistent state.
The idea is simple: since a single atomic transaction across services is usually impractical, accept that each step commits on its own, and plan for failure from the start. Every step must know how to undo itself, and the saga makes sure the undo steps run when they are needed. This article explains what the saga pattern is, how it works, and where it is used.
Key takeaways
- A saga splits a long transaction into local steps, one per service.
- Each step has a compensating action that undoes it if needed.
- On failure, compensations run in reverse order to restore consistency.
- Sagas trade strict atomicity for availability and scale.
- They are the standard pattern for multi-service business processes.
What the saga pattern is
A saga is a sequence of local transactions in which each step updates data in one service and then publishes an event, or returns a result, that triggers the next step. Unlike a distributed transaction, there is no coordinator holding locks across services, and each step commits its changes as soon as it finishes, so other services can see the intermediate state while the saga is still running.
There are two main ways to coordinate a saga. In choreography, each service listens for events and decides for itself what to do next, with no central controller. In orchestration, a central orchestrator tells each service what to do, tracks the overall state, and decides when to run compensations. Choreography is looser and easier to start, while orchestration is easier to follow, test, and debug.
The pattern was first described by Hector Garcia-Molina and Kenneth Salem in 1987, in a paper on long-lived transactions in databases, and it became widely used with the rise of microservices, where a single business process routinely spans many independently deployed services. Our guide to distributed systems explains the setting in which services must cooperate without a shared transaction, and our guide to ACID explains the atomicity guarantee that sagas deliberately give up in exchange for availability.
How the saga pattern works
Consider an order placed in an online shop. The saga begins by creating the order, then charges the payment, then reserves the stock, then arranges delivery. Each step is a local transaction in its own service, and each one commits before the next begins, so the payment service, for example, has already taken the money by the time the stock service is asked to reserve the items.
If every step succeeds, the saga completes and the order is placed. If a step fails, for instance because the stock is no longer available, the saga switches to compensation. It runs the compensating action for each completed step in reverse order: it cancels the delivery if one was arranged, releases the stock if any was reserved, and refunds the payment, so that the system ends up as if the order had never been placed.
A compensating action is not the same as a database rollback. A rollback erases a change as if it never happened, while a compensation is a new business action that reverses the effect, such as issuing a refund rather than deleting a payment record. The original records usually remain, marked as cancelled or refunded, which gives the business an audit trail of what happened.
Compensations must be designed carefully, because they run in a system that may still be failing. A compensation that itself fails needs to be retried, and it must be idempotent, meaning it can safely run more than once, so that a retry does not refund the same payment twice. The saga must also handle the case where a step succeeds but its success message is lost, and the orchestrator is unsure whether to continue or compensate.
Orchestration makes all of this easier to manage. The orchestrator keeps a record of which steps have completed, decides the next step, and drives compensations when needed, and because that record is durable, the saga can survive a crash of the orchestrator itself and resume where it left off.

Comparing the saga pattern with other approaches
The saga pattern is one of several ways to keep multi-service work consistent, and each was built with a different emphasis. Two-phase commit gives strict atomicity but blocks on failure, a single database avoids the problem by keeping the data together, and eventual consistency accepts temporary divergence without a formal undo plan.
The table below sets out the main contrasts between the leading approaches.
| Aspect | Saga pattern | Two-phase commit | Single database |
|---|---|---|---|
| Guarantee | Eventual, with compensation | Atomic, all or nothing | Atomic, all or nothing |
| Blocking on failure | No, compensations run | Yes, participants wait | No, one machine decides |
| Works across services | Yes, by design | Yes, with coordination | No, data must be together |
| Complexity | High, needs compensations | Moderate | Low |
| Best for | Long business processes | Traditional databases | Systems that fit one store |
The practical result is that a saga is the right choice when a business process spans many services and must keep running through failures, two-phase commit suits strict atomicity in traditional databases, and a single database is best whenever the data can simply be kept together.
Where the saga pattern is used
E-commerce uses sagas for the order process. Placing an order touches the order service, the payment service, the stock service, and the delivery service, and a saga coordinates them, refunding the payment and releasing the stock if delivery cannot be arranged, so that a customer is never charged for an order that cannot be fulfilled.
Travel booking uses sagas for trips that combine flights, hotels, and cars. Each booking is a separate step with its own provider, and if the hotel is no longer available after the flight is booked, the saga cancels the flight, so the traveller is not left with half a trip and no way to complete it.
Banking uses sagas for transfers that cross systems. A payment that moves money between accounts in different services, or different banks, cannot be a single transaction, so a saga debits one account, credits the other, and reverses the debit if the credit fails, keeping the books balanced at every step.
Cloud provisioning uses sagas to create resources. Setting up a new environment may create a virtual machine, attach storage, configure a network, and install software, and if one step fails, the saga deletes the resources already created, so that the customer is not billed for a half-built environment.
Subscription and billing systems use sagas to change plans. Upgrading a customer may change the plan, adjust the price, grant new features, and send a confirmation, and a failure part-way through is undone step by step, so the customer is never left on a plan they did not ask for.
Strengths and limits
The greatest strength of a saga is that it keeps working where a distributed transaction cannot. It needs no locks across services, no coordinator holding resources, and no single point of failure, so a business process can span dozens of services and still complete, or fail cleanly, even when parts of the system are down.
It is also a strength that sagas match how businesses actually think. A refund, a cancellation, and a release of stock are real business actions with records and audit trails, and a saga expresses the process in those terms, rather than hiding it behind a database mechanism that the business cannot see.
The limits are real, though. Writing a compensating action for every step is a large amount of work, and some steps cannot truly be undone, such as sending an email or dispatching a parcel, so the compensation can only apologise and offer a remedy. Intermediate states are also visible to other services, which means a customer might briefly see an order that is later cancelled, and the system must be designed to tolerate that.
Saga pattern checklist
- Define a compensating action for every step before you build.
- Make every compensation idempotent so retries are safe.
- Run compensations in reverse order when a step fails.
- Keep a durable record of which steps have completed.
- Choose orchestration when the flow is complex or must be audited.
- Choose choreography only when the flow is simple and stable.
- Design for steps whose success message is lost.
- Accept that some steps cannot be undone, only remedied.
- Test failure at every step, not only at the end.
Frequently asked questions
What is a saga in simple terms?
It is a sequence of steps, each in a different service, that together make up one business process. If a step fails, the saga runs undo steps for the ones that already succeeded, in reverse order, so the system ends up consistent.
What is a compensating transaction?
It is a business action that reverses the effect of an earlier step, such as refunding a payment or releasing reserved stock. Unlike a database rollback, it does not erase the original record; it adds a new record that cancels it out.
What is the difference between choreography and orchestration?
In choreography, services listen for events and decide for themselves what to do next, with no central controller. In orchestration, a central orchestrator tells each service what to do and drives compensations when a step fails.
Why not just use two-phase commit instead?
Two-phase commit needs locks across all participants and blocks if the coordinator fails, which does not scale across many services or distant data centres. A saga trades strict atomicity for availability, which suits long business processes far better.
Can a saga step be undone if it already sent an email?
No, not truly. Some actions, such as sending a message or dispatching a parcel, cannot be taken back, so the compensation can only send a correction or offer a remedy. Those steps should come as late in the saga as possible.
When should I not use a saga?
When the data fits in a single database, when strict atomicity is required, or when the process has only one or two steps. In those cases a local transaction, or a two-phase commit, is simpler and safer.
The bottom line
Saga pattern explained in one line is this: break the work into steps, give every step an undo, and run the undos in reverse when anything fails.
It is the pattern that lets a business process span many services and still end in a consistent state, trading strict atomicity for the freedom to keep running through failure.
This article is general information about how the saga pattern works, not advice about designing transactions for a particular system.







