Explain like I'm five · SRE

What is the CAP Theorem?

The CAP theorem, told as a story about two warehouses that lose contact and must choose.

Warehouse AWarehouse Bthe line is cut!should we keep serving guests?our numbers aren't updatingthe two warehouses can't reach each other — serve guests, or stop?

The two warehouses can't reach each other.Should they keep serving guests, or stop?

only correct answersstay open nowcan't have both at onceonce the line breaks, you can't have both at the same time

Why it's hard: you can't have both at once.Once the line breaks, you can't have both correctness and staying open.

the line is cutclosesINFO BOARDopen: keep servingnumbers catch up latermay briefly differwhen the line breaks, close for correctness, or stay open and catch up later

CAP = when the line breaks, choose correctness or staying open.Close the doors (consistency), or stay open and catch up later (availability).

Normally both are fineas long as the line holds
A broken line forces a choiceyou can't keep both
Money usually picks correctnessbetter closed than wrong
Display info usually picks staying opena little stale is fine
correctness (close)closesstaying open (catch up later)INFO BOARDkeeps showing somethingmatches up soonpick by what matters more — ticket booths choose correctness, info boards choose staying open

The scale: correctness (close) vs staying open (catch up later).Ticket booths choose correctness; info boards choose staying open.

Warehouse AWarehouse Bnormally the line is just finethis choice only matters when the line breaks

This choice only matters when the line breaks.Day to day, there's nothing to decide.

In one breath

The CAP theorem: when the line between warehouses breaks, you can't have both correctness and always-open at once — you must choose one.

The initials of Consistency, Availability, and Partition tolerance. Since network partitions must always be assumed possible, the real choice in practice is consistency vs. availability. A further refinement, PACELC, says you trade off latency vs. correctness even when nothing is broken.

When grown-ups say it

CAP Theorem
The rule that you can only keep two of three when the line breaks. A question every distributed system design has to answer.
Consistency (C)
Every counter gives the same answer. To keep this, a counter may close when the line breaks.
Availability (A)
Always giving some response. But that answer might not be the latest.
Partition Tolerance (P)
The system keeps running even when the line is cut. In practice, you have to assume this will happen.
Network Partition
The event where counters lose contact. The exact situation that forces the CAP choice.
PACELC
An extension: even without a break, you trade latency vs. correctness. CAP covers only the break; PACELC covers every day.
Strong Consistency
The promise of always showing the latest, correct answer. Usually preferred wherever money is involved.
Eventual Consistency
The promise that things match up eventually, even if a bit late. → the inventory board that catches up a little late
Next story
The Stock Board That Catches Up a Little Late →
Want another term as a picture book? Request →