Skip to main content
Concepts/Software Design & Architecture/saga-and-compensation-patterns

Saga & Compensation Patterns

Coordinate long-lived business transactions with compensating actions instead of distributed two-phase commit locks.

XLinkedInReddit
intermediate
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.

⚡ Next Step · Apply Concept

Ready to apply Saga & Compensation Patterns?

Test your understanding with a short scenario about real system constraints and trade-offs.

Share this concept

Share with fellow engineers or bookmark for system design discussions.

Share:XLinkedInReddit