Saga Pattern Explained: Orchestration Versus Choreography for Distributed Transactions

When an order spans separate services with their own databases, no single transaction can cover inventory, payment, and shipping, and cross-service two-phase commit is rarely practical. The saga pattern addresses this by running a sequence of local transactions, with compensating actions that semantically reverse earlier steps if a later one fails. Steps are classified as compensable, pivot, or retryable, and ordering them correctly determines whether the system can reach a consistent state. Sagas can be coordinated centrally by an orchestrator, which keeps the flow in one place and simplifies tracing, or through choreography, where services react to each other's events and suit simpler flows. The article also notes that sagas introduce eventual consistency and do not solve isolation problems on their own.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in