Sagas & Distributed Consistency
A single database transaction cannot span microservices — each service owns its own store. When a business operation touches multiple services (place order → reserve inventory → charge payment), you need a distributed transaction pattern. Two-phase commit (2PC) is rarely used in microservices because it locks resources across services and does not tolerate partitions well. The Saga pattern breaks the operation into a sequence of local transactions, each with a compensating action if a later step fails. If payment fails after inventory was reserved, the saga runs a compensate step to release the reservation. Sagas can be orchestrated (a central coordinator directs each step) or choreographed (each service listens for events and knows what to do next).