Back to Catalog
Microservices
Data Management
Saga
Distributed transactions without 2PC — a chain of local transactions with compensating rollbacks.
Intent & Description
Real-world Use Case
PlaceOrder Saga: (1) Order Service creates order → (2) Inventory Service reserves stock → (3) Payment Service charges card. If payment fails → compensating: Inventory releases stock → Order is rejected. All via events or orchestrator.
Source
📌 TL;DR
Saga = distributed transaction done right. Chain of local transactions + compensating rollbacks. Choose Choreography for simplicity, Orchestration for control.
Advantages
- No distributed transactions or 2PC — scales cleanly
- Each local transaction is ACID within its service
- Orchestration gives full visibility into saga state
- Choreography is fully decentralized — no single point of failure
Disadvantages
- Eventual consistency — system is temporarily inconsistent mid-saga
- Compensating transactions are complex to write and test
- Choreography can become a spaghetti of events hard to trace
- Orchestration introduces a central coordinator to build and maintain
- Debugging failed sagas requires distributed tracing tooling