AlgoViz

Saga pattern

medium 30 min

A saga is a chain of local transactions, one per service, with an undo step for each.

Where it shows up

The same pattern appears across everyday software.

  • AWS Step Functions

    AWS's own guidance shows a saga orchestrator built as a Step Functions workflow that runs compensating steps when a later one fails.

  • Temporal

    Its documentation recommends starting with the saga pattern to compensate for steps that already succeeded.

  • Apache Seata

    Offers a Saga mode. Each participant commits locally, and earlier participants are compensated if one fails. Its page cites the 1987 paper.

  • Camunda and BPMN

    Process diagrams can attach a compensation handler to an activity. Throwing a compensation event runs the undo step.

  • Eventuate Tram Sagas

    A framework used as the example for orchestration-based sagas on microservices.io.

  • Trip booking

    A flight, a hotel and a car come from three companies. If the car is gone, the other two bookings are cancelled. It is the classic teaching example.