# Saga

> Distributed transactions without 2PC — a chain of local transactions with compensating rollbacks.

- **Category**: Microservices
- **Subcategory**: Data Management
- **Canonical URL**: https://designpattern.fyi/patterns/saga/

---

## Description
Clean, reusable architecture pattern.


## Use Cases
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.





## Trade-offs


### 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




### Considerations & Drawbacks

- 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







---
**Reference**: [Original Source](https://microservices.io/patterns/data/saga.html)

