← Back to Index
06 · Distributed Theory

The CAP Theorem

In any distributed system, you can only guarantee 2 of 3 properties. Network partitions are unavoidable — so the real choice is Consistency vs Availability.

CA — Consistency + Availability
Single-node relational DBs. When there's no network partition, you get both. But real distributed systems always face partitions.
CP — Consistency + Partition Tolerance
Returns an error rather than stale data. Banking, financial, inventory systems choose this. Data is never wrong — but may be temporarily unavailable.
AP — Availability + Partition Tolerance
Always responds, even if slightly stale. Social feeds, DNS, shopping carts, analytics choose this. Users get fast responses; data syncs eventually.
PACELC extends CAP: even without partitions (E), there's a trade-off between Latency and Consistency.