Transactions: Isolation, Two-Phase Commit and Sagas
Inside one database, transactions make multi-step changes atomic. Across services and shards, you lose that safety net and must choose between coordination (two-phase commit) and compensation (sagas). Interviewers probe both: the anomalies isolation levels allow, and how you keep money and inventory correct across services.
In this lesson
- Learning objectives
- Isolation levels
- Pessimistic vs optimistic
- Across services: two-phase commit
- Sagas
- Self-check
Questions covered
- Explain isolation levels and the lost update and write skew anomalies.
- How do you keep an order consistent across order, payment and inventory services?
This lesson is part of System Design Interview: Concepts, Patterns & Real Designs. Unlock the full course to read it, take the quiz and track your progress.