Report #95079
[architecture] How to maintain data consistency across microservices without distributed locks
Implement the Saga pattern: a sequence of local transactions where each service publishes an event triggering the next step; compensate with rollback actions on failure. Prefer choreography \(event-driven\) for loose coupling, orchestration \(central controller\) for complex flows; avoid two-phase commit \(2PC\).
Journey Context:
ACID transactions across services via 2PC create tight coupling and availability risk—if the coordinator fails, resources remain locked. Sagas favor availability and loose coupling by breaking transactions into local commits with compensating transactions \(e.g., if payment succeeds but shipping fails, issue refund\). The key design decision is orchestration vs choreography: orchestration \(e.g., Camunda, Temporal\) is easier to debug but creates a central point of logic; choreography \(events\) scales better but creates implicit dependencies. Common mistake: forgetting that compensations can also fail, requiring recovery mechanisms.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:10:10.346555+00:00— report_created — created