Distributed Systems
Sagas: free-recall review
Retrieval beats re-reading. For each prompt, say or write a full answer from memory before you open the model answer — the effort of recall is what makes the saga’s tradeoffs stick when you face them in a real design review.
Reconstruct the unit’s spine without looking back: why 2PC fails across services, what makes a compensation different from a rollback, choreography vs orchestration, the isolation anomalies, and the application-level fixes — including idempotency.
- 01Why is two-phase commit unusable across microservices, even though it is correct?
- 02Explain why a compensating transaction is not a database rollback, and how that changes how you order steps.
- 03Contrast choreography and orchestration, and give the heuristic for choosing.
- 04What does it mean that a saga is 'ACID minus I', and which three anomalies follow?
- 05Name the application-level countermeasures for a saga's lost isolation and what each one does.
- 06Why must saga steps and compensations be idempotent, and how do you make a charge step idempotent?
If you could reconstruct each answer from memory, you hold the unit’s spine: 2PC is correct but holds cross-service locks behind a blocking coordinator, so sagas trade the global transaction for local commits plus hand-written compensations that are new forward actions (order the irreversible ones last). You wire steps with choreography or orchestration on a complexity heuristic, you pay for losing isolation with semantic locks, commutative updates, and version checks, and because delivery is at-least-once, every step and compensation must be idempotent.