Sagas and distributed transactions
Lesson 30 of 40 · Sys.Micro
No single transaction spans services. Chain local steps and undo them when something fails.
Charge the card (payments), reserve stock (inventory), book a courier (shipping). Each service has its own database. If shipping fails after the card was charged, the customer paid for nothing.
Why two-phase commit is rarely used across services
Check yourself
In a saga, step 3 of 3 fails. What happens?
Do it in the browser: a real system design tool, a short mission and instant feedback. No install.
Start this lesson — free