DBRaven
Relationship · Mitigates
Source: Pattern·Target: Pattern

Summary

Saga replaces two-phase commit with a sequence of local transactions and compensating transactions, eliminating the blocking distributed lock problem of 2PC at the cost of eventual consistency and more complex failure handling.

Evidence

  • ·Saga avoids distributed locks entirely: each step commits locally and forwards control
  • ·{'Compensating transactions handle rollback': 'if step 3 fails, compensating transactions undo steps 1 and 2'}
  • ·Uber's TripFulfillment saga replaced a 2PC-based transaction system that failed under network partitions
  • ·Amazon's internal service mesh uses sagas for multi-service order processing
  • ·Axon Framework and Eventuate provide saga orchestration infrastructure for Java microservices

Operational Context

  • ·Choreography-based sagas (event-driven) are decoupled but harder to trace: use correlation IDs
  • ·Orchestration-based sagas (central coordinator) are easier to reason about but introduce a coordinator component
  • ·Compensating transactions must be idempotent: they may be retried multiple times

Tradeoffs

  • ·Saga does not provide atomicity: intermediate states are visible between steps
  • ·Compensating transactions add implementation complexity: every step needs a corresponding undo operation
  • ·{'Eventual consistency': 'a saga rollback takes time: the system is briefly inconsistent during compensation'}

Evidence grounding

Grounded, 5 supporting items

Saga pattern as an alternative to 2PC is documented in Microservices Patterns (Richardson), the original Saga paper (Garcia-Molina, Salem, 1987), and production microservice architectures at Uber and Airbnb.