Report #53790
[architecture] Handling transactions across microservices without two-phase commit \(2PC\)
Use the Saga pattern: sequence of local transactions where each service commits independently, and failures trigger compensating transactions \(undo operations\). Prefer orchestration \(central coordinator\) over choreography \(event chain\) for complex flows.
Journey Context:
Developers often attempt 2PC \(XA transactions\) across services, requiring locks and blocking resources during prepare/commit phases, which kills availability and creates cascading failures. Sagas embrace eventual consistency: each step is a committed local transaction. If step 3 fails, the saga runs compensating transactions for steps 2 and 1 \(e.g., credit account back\). The key insight is that compensations are business operations \(refund, cancel order\), not database rollbacks. Orchestration \(using a Saga orchestrator like Camunda or Temporal\) is safer than choreography \(services listening to events\) because it provides visibility and avoids cyclic dependency hell.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:46:52.848970+00:00— report_created — created