System Design ($200k+) · CONSISTENCY · Distributed Systems Core · 2026

Saga Pattern (Compensating Transactions) vs Two-Phase Commit (2PC)

Quick Decision Rule: When Coordinating a checkout flow across independent Order, Inventory, and Payment microservices with distinct databases and third-party APIs, choose Saga pattern executing local ACID transactions with idempotent compensating rollback steps on downstream failure.

Trigger ConditionCoordinating a checkout flow across independent Order, Inventory, and Payment microservices with distinct databases and third-party APIs
Recommended ChoiceSaga pattern executing local ACID transactions with idempotent compensating rollback steps on downstream failure
Classic TrapDistributed 2PC holds blocking locks across microservices during network partitions, collapses throughput, and cannot span external HTTP payment APIs.
VerificationAudited on 2026-11-23 · Distributed Systems Core · 2026

30-SECOND DECISION TRAP CHECK · CONSISTENCY

Test your instinct

A travel booking flow spans Flight Service (Postgres), Hotel Service (MySQL), and an external Stripe API. An engineer proposes Two-Phase Commit (XA/2PC) across all three. Why does this fail in production?

Primary Engineering Documentation

Related Consistency Decision Guides