Try
↑ ↓ move↵ openesc close
In this lesson · topic 3 of 7
  1. 1. An order that spans four services
  2. 2. Steps, undos and the reverse order
  3. 3. Fail steps and watch readers see the middle
  4. 4. Atomic in the end, visible in the middle
  5. 5. One conductor or a chain of events
  6. 6. When the undo cannot be done
  7. 7. Compensation, isolation and coordination

Topic 3

Fail steps and watch readers see the middle

8 min read

What the lab runs

Two sagas start each tick. Each step fails with the chance you set. A failed saga compensates in reverse, and an undo can fail and be retried. Six times a tick, a reader looks at a random saga in flight and sees whatever its finished steps have changed.

Messages are counted too. Orchestration sends a command and gets a reply for each action. Choreography sends one event.

Predict before you press play

You switch from orchestration to choreography. What happens to messages per saga?

tick 1504 steps, orchestrationchance of no failure: 72%

Outcomes

started
300
committed
221 (75%)
compensated
72
parked
0
in flight
7

A saga runs its steps one after another. When a step fails, it runs the undo of every earlier step in reverse order. An undo that keeps failing parks the saga for a person.

Cost

messages per saga
7.9
latency
3.9 ticks
work undone
9% of steps

Orchestration sends a command and gets a reply for every action. Choreography sends one event per action, and no one place holds the whole story.

What a reader sees in the middle

reads of half-done work
900
of those, later undone
23%
told it is pending
0%

A reader that looks at a record while a saga is running sees its early steps. If that saga later fails, the reader saw something that never really happened.

Sagas in flight over the last 120 ticks
Sagas in flight over the last 120 ticks. Text version available below the chart.035810161120recent tickssagas

Full-page version with guided experiments: Saga compensation lab.

Things to try

  1. Raise the steps to 8 and read the committed share.
  2. Switch between orchestration and choreography and read messages per saga.
  3. With isolation off, read how many reads saw work that was later undone.
  4. Turn on the semantic lock and read the same line.
  5. Set undo failure to 50 percent and read the parked count.

The full-page lab has a guided experiment for each of these.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms