Saga
Local transactions with compensating actions across services.
5 to work through
-
intermediate
Review this. A grocery-fulfilment platform in the mould of Instacart runs an orchestrated saga over five steps - cart freeze, pricing, promotion, loyalty accrual, order creation - each with a compensating action, driven by an orchestrator with its own saga log. All five services are owned by one team, deployed as one binary, and write to five schemas in one Postgres cluster. What would you remove, and what would you leave alone?
3 min answer -
advanced
A multi-party booking saga is running in production and support cannot answer where a particular booking is. What is missing from the implementation?
2 min answer -
advanced Multiple choice
An order flow spans several services and cannot use a distributed transaction. What decides between orchestration and choreography for the saga?
2 min answer -
advanced
An order spans payment, inventory and shipping, each in its own service with its own database. How do you keep them consistent?
3 min answer -
advanced
Design an order saga: reserve inventory, take payment, dispatch shipment, send confirmation. What ordering problem do you see?
2 min answer
3 terms in this topic
Durable Execution
Running workflow code whose complete execution history is persisted, so a crashed process resumes by replaying that history rather than restarting - …
practiceSaga Compensation Design
Designing the undo actions for a distributed transaction, where compensation is a new business action rather than a rollback.
conceptSaga Isolation Anomaly
The intermediate states visible to other transactions during a saga, because a saga provides atomicity and durability but not isolation.
Neighbouring topics
Architecture Patterns
General material on architectural patterns and their trade-offs.
Layered Architecture
The default shape, its clarity, and where a technical partition fails.
Event-Driven Architecture
Publishing facts, and trading comprehensibility for decoupling.
Pipes and Filters
Independent transformation steps composed into a pipeline.
Publish/Subscribe
Broadcast to every subscriber, as distinct from work distribution.
Competing Consumers
Scaling throughput with instances, at the cost of ordering.
CQRS
Separate models for writing and reading, each optimised for its job.
Event Sourcing
The event log as the system of record, with state as a projection.
Outbox
Making the event atomic with the business write it describes.
Strangler Fig
Incremental replacement behind a routing facade.
Anti-Corruption Layer
Translating a foreign model at the boundary so it does not leak in.
Sidecar & Ambassador
Cross-cutting behaviour in a co-deployed process.
Service Mesh
Sidecars applied estate-wide, and the scale at which that pays.
API Gateway
A single entry point for policy, routing and protocol translation.
Backend for Frontend
A narrow backend per client experience, owned by that client's team.
Cell-Based Architecture
Complete isolated copies each serving a subset of customers.
Sharding Patterns
Directory versus embedded keys, logical shards and rebalancing.
Materialized Views
Precomputed query results, refreshed incrementally or in full.
Orchestration vs Choreography
A coordinator that knows the flow, or services that react to events.