Report #4588
[architecture] Using 2PC/XA distributed transactions across microservices instead of the Saga pattern
Replace two-phase commit \(2PC\) with the Saga pattern using compensating transactions; implement as orchestration \(central coordinator\) for complex flows or choreography \(event-driven\) for simpler ones, accepting eventual consistency.
Journey Context:
Developers coming from monolithic databases often try to maintain ACID across microservices using XA/2PC. This fails because the coordinator becomes a single point of failure, locks are held during the prepare phase \(blocking other operations\), and it is blocking/synchronous—unacceptable for long-running operations or across unreliable networks \(CAP theorem: partition tolerance requires giving up true atomicity\). The Saga pattern breaks the transaction into a sequence of local transactions, each publishing an event that triggers the next. If a step fails, compensating transactions \(undo operations\) are run for completed steps. The tradeoff is complexity in handling 'in-doubt' states and lack of isolation \(dirty reads possible\), but it provides availability and partition tolerance.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T19:44:39.121274+00:00— report_created — created