Workflow orchestrator
AWS Step Functions
Runs multi-step business processes reliably: retries, timeouts and compensations (sagas).
In a monolith
One DB transaction
In a monolith a checkout is one transaction: reserve stock, charge, create the order — commit or roll back together.
In a distributed system
Saga orchestrator
Each step calls a different service; if step 3 fails the orchestrator runs compensations (refund, release stock). State is persisted, so a crash resumes mid-flow.
On AWS
AWS Step Functions
State machines with built-in retries, catch/compensation, waits and parallel branches — Standard (long-running, durable) or Express (high-volume, short).
- Step Functions Standard$$Durable and auditable, long-running workflows
- Step Functions Express$High-throughput, short workflows
- Temporal$$Workflows as code with strong durability (self-hosted or cloud)
- Reach for it when
- A business process spans several services and must either complete or be compensated.
- What it costs you
- Every step needs a designed compensation (a refund is not an undo)
- Intermediate states are visible to users (eventual consistency)
- Another component to learn and operate
- When it dies
- In-flight workflows pause; a durable orchestrator resumes from the last persisted step.
Interview follow-ups
Orchestration vs choreography?
Orchestration: a coordinator calls each step — clear flow, one place to look. Choreography: services react to each other’s events — looser coupling, harder to trace.
Why not a distributed transaction (2PC)?
2PC holds locks across services and blocks if the coordinator dies; most cloud services don’t support it. Sagas trade atomicity for availability via compensations.
Connection rules
Gets traffic from
- App server
- Service
- Worker
- Scheduler
- API gatewayOnly when: API Gateway can start a Step Functions execution directly (async APIs).