Sagas & Compensation
Replacing atomicity with semantic undo, and ordering the irreversible steps last.
6 to work through
-
intermediate
A service updates its database and then publishes an event. Occasionally downstream systems are missing records. Diagnose and fix.
2 min answer -
advanced
A long-running customer workflow spanning payment, verification, notification and fulfilment must survive worker crashes and deploys mid-flow. Compare a hand-written saga with a durable-execution engine.
2 min answer -
advanced
A marketplace charges the customer, pays the merchant, pays the courier and takes a fee. Design the transaction, and say what happens if the courier payment fails.
2 min answer -
advanced
A shipping aggregator books a shipment across carrier, warehouse, payment and notification systems, with no shared transaction available. Which coordination pattern fits, and what are the compensations that cannot exist?
2 min answer -
advanced
Design the order-fulfilment saga for a marketplace where sellers can cancel, buyers can cancel, payments can fail asynchronously hours later, and items are unique. What states and compensations are required, and where does orchestration beat choreography?
2 min answer -
advanced
In an order saga, the shipment service permanently rejects an order after the card has been captured. What now?
2 min answer
5 terms in this topic
Compensating Transaction
A business operation that semantically undoes a previously committed step — not a rollback, because the original effect was visible and may not be fu…
conceptCompensation Impossibility
The recognition that some saga steps have no true compensating action, and the design rule that follows - order steps by reversibility and gate the i…
patternOutbox Pattern
Writing a message to a table in the same database transaction as the state change, then publishing it asynchronously, so the two cannot diverge.
conceptPivot Transaction
The step in a saga after which the transaction can no longer be cancelled — everything before it is compensatable, everything after it is retriable u…
patternSaga Orchestrator
A component that explicitly drives a saga's steps and compensations, holding the flow in one place rather than distributing it across event subscriptions.
1 artifact you would hand over
Neighbouring topics
Distributed Systems
General material on partial failure, coordination and distributed reasoning.
CAP & PACELC
What you must give up during a partition, and the latency choice the rest of the time.
Consistency Models
Linearizable, sequential, causal, eventual, and the session guarantees between them.
Idempotency
Making an operation safe to repeat, because a client that times out cannot know.
Retries & Backoff
Exponential backoff, jitter, retry budgets, and how retries become the outage.
Timeouts & Deadlines
Per-hop timeouts that do not compose, and the deadline budget that replaces them.
Circuit Breakers
Failing fast on a broken dependency, and what you fail fast to.
Backpressure & Flow Control
Telling callers to slow down instead of buffering into congestion collapse.
Load Shedding
Rejecting some work deliberately so the rest can be served correctly.
Bulkheads & Isolation
Partitioning resources so one dependency cannot starve the others.
Leader Election
Agreeing who is in charge, and fencing the one who no longer is.
Consensus Protocols
Raft, Paxos and quorums — what they guarantee and what they cost.
Distributed Locking
Mutual exclusion across machines, and why it is harder than it looks.
Distributed Transactions
Two-phase commit, its blocking failure mode, and when it is still reasonable.
Service Discovery
Finding a healthy address for something whose instances are ephemeral.
Messaging & Queues
Decoupling producer from consumer, and the semantics that come with it.
Event Streaming
Retained ordered logs, consumer offsets, partitions and replay.
Clocks & Ordering
Why wall clocks lie, and how logical clocks and versions restore order.
Failure Modes
Slow rather than down, partial, grey, and failing while reporting success.