The Saga Pattern for Distributed Transactions
Learn how to maintain data consistency across microservices without distributed transactions, using the Saga pattern with choreography and orchestration.
The Distributed Transaction Problem
In a monolith, one database transaction can update everything atomically. In microservices, each service owns its own database, so a single classic transaction across them is impractical.
How do you keep data consistent when an operation spans multiple services?
Why Not Two-Phase Commit?
Two-phase commit (2PC) can coordinate a distributed transaction, but it locks resources across services and blocks if the coordinator fails. It scales poorly and hurts availability — usually the wrong fit for microservices.
All lessons in this course
- Decomposing Monoliths
- Service Discovery & Registry
- Inter-Service Communication Patterns
- The Saga Pattern for Distributed Transactions