CMD Guide
HomeSystem DesignMicroservices Patterns

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

When NOT to use

Orchestration vs choreography (pick deliberately)

OrchestrationChoreography
VisibilityOne place to read the flowScattered handlers
CouplingServices couple to orchestrator commandsCouple to event contracts
Failure handlingCentral compensation logicEach service must know undo path
Best forComplex branches, >~4 stepsShort, stable happy paths
RiskGod-object orchestratorEmergent spaghetti; hard incidents

Top production alerts

  1. 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.
  2. Compensation failure rate (undo itself failing — money/inventory leak).
  3. Duplicate execution counters (missing idempotency on commands/events).

Eight-line review checklist

  1. Why not one local transaction?
  2. Why not 2PC?
  3. What is the pivot step?
  4. List compensation for each prior step — are they true undos?
  5. Idempotency keys on every command/event handler?
  6. Durable saga state + recovery story?
  7. Semantic locks / status fields for the isolation gap?
  8. 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

  1. Q: ACD not ACID — which letter drops? A: Isolation — concurrent readers see intermediate saga state unless you design semantic locks.
  2. Q: SMS "order confirmed" before inventory step — problem? A: Irreversible effect before pivot; move notifications after success or accept compensatory messaging.
  3. 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.

🎨 Explain it visually

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.
🤔 Walk me through it (interactive)

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.
🧪 Quiz me & fix my gaps

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.
🧠 Make it stick

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.

📝 My notes