Report #39110
[architecture] Implementing distributed transactions \(2PC\) across microservices
Adopt the Saga pattern using orchestration \(central coordinator\) or choreography \(event-driven\) with explicit compensating transactions to undo completed steps; avoid two-phase commit \(2PC/XA\) due to blocking locks and coordinator single-point-of-failure.
Journey Context:
2PC locks resources across services until the coordinator commits, creating blocking, latency, and unavailability if the coordinator fails—violating microservice autonomy. Sagas model long-running transactions as a sequence of local ACID transactions, each publishing an event or command to trigger the next step. If a step fails, compensating transactions \(semantic undo\) run for completed steps \(e.g., cancel order, refund payment\). Orchestration \(central saga manager\) is easier to debug for complex flows; choreography \(services react to events\) is decoupled but harder to trace. This pattern accepts eventual consistency between steps, appropriate for most business operations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T20:07:19.126624+00:00— report_created — created