Question
An order-fulfillment flow must atomically reserve funds (payments service, us-east), decrement inventory (inventory service, eu-west), and create a shipment (logistics service, ap-south) — three services, three databases, three regions. The product needs the whole thing to be all-or-nothing from the user's perspective. The team's first instinct is cross-region two-phase commit (2PC) with a coordinator. Explain precisely why 2PC across regions is dangerous here (blocking, coordinator failure, latency, holding locks across an 80–200ms WAN), then design the alternative that gives the user effective atomicity. Address partial-failure compensation, idempotency, and what 'atomic' realistically means here.
Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.