Saga & Compensation Patterns
Coordinate long-lived business transactions with compensating actions instead of distributed two-phase commit locks.
Concept Breakdown
đĄ Why It Matters
Microservices cannot hold cross-service locks; sagas are how checkout, travel booking, and billing stay coherent.
đ Real-World Production Usages & Examples
Travel reservation
Scenario: Reserve flight, hotel, and car across vendors.
Outcome: Failed hotel booking triggers flight cancellation compensation.
â When to Use
- â˘Multi-service business workflows
- â˘Long-running processes
- â˘When 2PC latency/availability is unacceptable
â When NOT to Use
- â˘Single database ACID suffices
- â˘Compensations are impossible for the domain
đ Core Architecture & Rules
- 1Compensations are business operations, not rollbacks
- 2Orchestrator vs choreography trade-offs
- 3Idempotency required on every step
âď¸ Architectural Trade-Off Analysis
Orchestration
PROClear visibility
CONCentral coordinator becomes critical path
â ď¸ Failure Modes & Mitigations
Missing compensation
Forward step succeeds but rollback path undefined.
Mitigation: Design compensations before shipping forward actions.
đ ď¸ Example Usages
Reviewed practical implementations and concrete code walkthroughs for Saga & Compensation Patterns.
No reviewed practical examples currently published for this concept. Queued for technical review.
â
Explore Related Concepts & Guides
Curated technical reading and direct concept relationships.
Connected ConceptsExplore full connection graphâ
⥠Next Step ¡ Apply Concept
Ready to apply Saga & Compensation Patterns?
Test your understanding with a short scenario about real system constraints and trade-offs.
