Every booking you've ever made online is secretly a chain of promises. Reserve a flight. Charge a card. Notify the airline. Update loyalty points. If any link breaks, all the earlier links must unwind — cleanly, without leaving you charged for a seat you don't have.
The classical answer is an ACID transaction: wrap everything in one big lock, commit once, rollback on failure. That works perfectly inside a single database. But once your workflow crosses service boundaries — an inventory service, a payment service, a notification service — holding one lock for seconds or minutes becomes a bottleneck, a deadlock risk, and often simply impossible.
Hector Garcia-Molina and Kenneth Salem described the solution in their 1987 paper: a saga. Break the long-running operation into a sequence of smaller local transactions, each of which commits immediately. If a later step fails, run compensating transactions in reverse order — each one undoing the effect of the step before it. No global lock ever held; eventual consistency guaranteed.
The pattern is so fundamental that every major cloud architecture guide lists it. Understanding it means understanding how the systems behind flights, hotel bookings, and e-commerce orders actually stay sane.
Comments
Loading comments...