Conclusion
Saga Pattern — decision checklist
Drop the knight metaphors. A saga is a deliberate trade: availability and service autonomy instead of global ACID. If you cannot name compensations, the pivot, and the isolation hole, you are not ready to ship one.
When to use
- Workflow mutates multiple autonomous services / datastores.
- Flow may be long-lived (humans, couriers, external APIs).
- You can implement idempotent compensations for every pre-pivot step.
- Business accepts eventual consistency and transient intermediate states.
When NOT to use
- All data in one DB → local ACID transaction.
- Few XA resources, one trust boundary, short, correctness-critical → 2PC may win.
- Irreversible side effects must run early and cannot be reordered past the pivot.
- Team will not build durable saga state, metrics, or idempotent handlers.
Orchestration vs choreography (pick deliberately)
| Orchestration | Choreography | |
|---|---|---|
| Visibility | One place to read the flow | Scattered handlers |
| Coupling | Services couple to orchestrator commands | Couple to event contracts |
| Failure handling | Central compensation logic | Each service must know undo path |
| Best for | Complex branches, >~4 steps | Short, stable happy paths |
| Risk | God-object orchestrator | Emergent spaghetti; hard incidents |
Top production alerts
- Sagas stuck non-terminal beyond SLO (orchestrator crash / lost message). First responder reads the saga log to find the last terminal step, then decides resume-forward vs resume-compensation — never hand-edits service databases first.
- Compensation failure rate (undo itself failing — money/inventory leak).
- Duplicate execution counters (missing idempotency on commands/events).
Eight-line review checklist
- Why not one local transaction?
- Why not 2PC?
- What is the pivot step?
- List compensation for each prior step — are they true undos?
- Idempotency keys on every command/event handler?
- Durable saga state + recovery story?
- Semantic locks / status fields for the isolation gap?
- Who gets paged when a saga is stuck 15 minutes?
Where each line was armed: lines 1–2 are the Problem lesson (2PC blocking, when locality wins); line 3 and the pivot logic are Inner Workings; line 4's true-undo test is the Architecture lesson's compensation pairing table; lines 5–6 are the worked Example (saga log + idempotency keys); line 7 is the Solution lesson's countermeasures.
Drill ladder
- Q: ACD not ACID — which letter drops? A: Isolation — concurrent readers see intermediate saga state unless you design semantic locks.
- Q: SMS "order confirmed" before inventory step — problem? A: Irreversible effect before pivot; move notifications after success or accept compensatory messaging.
- Q: Prefer choreography for 8-step fulfillment? A: Usually no — orchestrator for operable narrative and branching.
Takeaway
Saga = local commits + reverse compensations + explicit pivot + idempotency + durable coordinator state. Everything else is branding.
🤖 Don't fully get this? Learn it with Claude
Stuck on Conclusion? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.
Build the mental picture, not memorization.
I just read a lesson on **Conclusion** (System Design) and want to truly understand it. Explain Conclusion from first principles using ONE vivid real-world analogy and a visual mental model — draw it as ASCII art or a clear step-by-step diagram — with a concrete example using real numbers. Then ask me one question to check I got the mental picture, and wait for my reply. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
Socratic — adapts to where you're stuck.
Teach me **Conclusion** interactively. Ask me ONE guiding question at a time, wait for my answer, and adapt to my confusion — build the idea with me step by step instead of explaining it all at once. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
Active recall exposes what you missed.
Quiz me on **Conclusion** with 5 questions, easy to tricky, ONE at a time. Tell me if each answer is right; at the end, explain clearly what I got wrong and why. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
Intuition + hook + flashcards for long-term memory.
Help me remember **Conclusion** for the long term: give the one-sentence intuition, a memorable hook/mnemonic, a tiny worked example, and 3 active-recall flashcards (Q -> A). If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.