Course contentsShow
← System Design
Lesson 487 of 1,91914. CAP TheoremFree lesson

Why You Cannot Have All Three

During a partition, responding guarantees availability but risks inconsistency; waiting for consensus ensures consistency but loses availability.

Why You Cannot Have All Three

What you'll learn: Why it's mathematically impossible to guarantee consistency, availability, and partition tolerance simultaneously during a network partition.

The Fundamental Impossibility

The CAP theorem isn't a design guideline—it's a proof of impossibility. When a network partition occurs (splitting your distributed system into isolated groups), you face a brutal binary choice: respond or wait.

The Two Paths During a Partition

Path 1: Choose Availability (Sacrifice Consistency)

If you allow isolated nodes to accept writes independently, you maintain availability—every request gets a response. But now nodes on opposite sides of the partition hold different data. You've lost consistency.

Analogy: Two bank branches lose their network connection. Both allow withdrawals from the same account. The account becomes overdrawn, but customers were served (available). The balances are now inconsistent.

Path 2: Choose Consistency (Sacrifice Availability)

If you refuse to respond until all nodes agree, you maintain consistency—everyone sees the same data. But nodes cut off from the majority cannot respond to requests. You've lost availability.

Analogy: The same two branches refuse all transactions until they can communicate again. Account data stays consistent, but customers are turned away (unavailable).

Why No Third Option Exists

You cannot "wait a little bit" or "respond sometimes." Either a node responds to a client (availability) or it doesn't. Either that response reflects the latest write across all nodes (consistency) or it doesn't. There's no middle ground during the partition itself.

Partition tolerance isn't optional—networks will fail. So in practice, you're always choosing between consistency and availability when the partition happens.

Key Takeaway: During a partition, responding immediately sacrifices consistency for availability; waiting for consensus sacrifices availability for consistency—there is no option that preserves both.