Try
↑ ↓ move↵ openesc close

Interview prep / Sagas

Junior · Sagas · System design interview question

What is a saga?

Sketch your own answer first, then compare it with the one below.

A strong answer

A saga is a long transaction split into a sequence of local transactions. Each local transaction commits on its own in one service. Each has a compensating action that undoes its effect.

If every step succeeds, the saga is done. If one fails, the compensations of the earlier steps run in reverse order.

The trade-off is that a saga is atomic in the end but not isolated. Other work can see the steps while the saga is running.

Sources

Learn it by running it

The sagas and compensation lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

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