Visual walkthrough — CAP theorem — consistency, availability, partition tolerance
Everything here is a story about two machines that hold a copy of the same fact. That is the heart of a distributed system. Let us build it from nothing.
Step 1 — Two boxes, one fact
WHAT. Draw two computers. Call them and . The letter just stands for node — one machine in the system. The little number under it is only a name tag, so we can tell them apart. Each box stores one fact, a value we call . Right now both boxes agree: .
Read the symbols out loud like this:
- — the thing we are remembering (a bank balance, a score, a cart).
- — the value it currently holds. The letter means "value"; the little means "the starting one, version zero."
WHY two boxes and not one? Because one box is fragile — if it dies, your data is gone, and it can serve only so many customers. So real systems keep copies (called replicas) on several machines. The moment you have copies, you have a new problem: keeping them in agreement. That problem is the whole story.
PICTURE. Two identical boxes, a wire between them, both showing in green. Peace.

Step 2 — The wire can break (the partition)
WHAT. Cut the wire. Now and are both alive and both working, but they cannot send messages to each other. Any message either one tries to send is dropped or delayed forever. This broken state is called a partition.
WHY draw this as unavoidable? Because it is. Cables get cut by digging machines, a switch reboots, a machine freezes for two seconds during a garbage-collection pause and misses everything. Nobody chooses a partition — the physical world imposes it. This is exactly why the parent note insists P is not optional: you can only choose how to behave when it happens.
PICTURE. The same two boxes, but the wire is now a broken red zig-zag. Both boxes are still lit up — alive, just deaf to each other.

Step 3 — A write lands on one side
WHAT. A client walks up to and says: "set ." Here is a new value, version one — the fresh, latest truth. obeys and updates its own copy. Now holds ; still holds the stale .
Term by term, the event is: The arrow means "is assigned" — the box's memory is overwritten with .
WHY does not learn about it? tries to forward the update ("hey , it's now!"), but Step 2 killed the wire. The message vanishes. This is the crucial fact: has zero information that any write ever happened.
PICTURE. flips to a coral ; a message arrow leaves heading right but crashes into the broken wire and disappears. still shows green , blissfully unaware.

Step 4 — A read arrives on the other side
WHAT. Now a second client walks up to and asks: "what is ?" must respond. It has exactly two kinds of response available, and no third option:
- (a) Answer with a value — it can only offer , the only value it knows.
- (b) Refuse — reply "error / I can't tell you right now."
WHY only these two? A machine can either hand back data or hand back an error/timeout. There is no magical door that lets it hand back : it has never heard of (Step 3). So the content of any successful answer is forced to be .
PICTURE. A client arrow points into with a question mark. Two dashed reply arrows fan out of : one labelled "" (answer), one labelled "error" (refuse). is drawn faded and crossed out — the option physically cannot produce.

Step 5 — Line up the two demands and watch them collide
WHAT. Put the two definitions from Step 4 side by side against 's two possible moves:
| does... | Returns | Satisfies C? () | Satisfies A? (non-error) |
|---|---|---|---|
| (a) Answer | ❌ (it's stale, not ) | ✅ | |
| (b) Refuse | error | ✅ (never returns a wrong value) | ❌ |
WHY this is a contradiction, not just a bad day. To satisfy C, the answer must equal . To satisfy A, the answer must be a value (not an error). The only value can produce is . So: The symbol means "and" — both at once. The line says: no single response checks both boxes.
PICTURE. A two-row scoreboard. Row (a): green tick under A, red cross under C. Row (b): green tick under C, red cross under A. A big red "no row has two ticks" banner underneath.

Step 6 — Edge case: what if nobody wrote?
WHAT. Rewind. Suppose the wire is cut (partition present) but no client ever writes. Both boxes still hold . A read hits . It answers .
WHY does the theorem "relax" here? Because now is the most recent write — there is no newer to be out of step with. C wants "latest write," and genuinely is the latest. So the answer is both available and consistent. No contradiction.
PICTURE. Broken wire, both boxes green , no write arrow anywhere, happily returns with a double tick (C ✅ A ✅).

Step 7 — Edge case: no partition at all
WHAT. Now heal the wire. A write hits ; immediately forwards it to ; a later read on returns .
WHY both C and A now? With the wire alive, the information gap from Step 3 never opens. does know . So it can answer (A) with the latest value (C) at the same time. CAP forces no sacrifice when there is no partition.
But — and this is the PACELC theorem twist — forwarding to and waiting for it to confirm takes time. If you wait, reads everywhere see (consistent) but writes are slow (high Latency). If you don't wait, writes are fast but a read on might briefly still see (stale). A quieter version of the same tug-of-war runs even on a perfect network.
PICTURE. Healed green wire; write on with a successful message arrow reaching ; both boxes turn coral ; a small clock icon on the arrow labelled "costs latency (PACELC)."

The one-picture summary
Everything above collapses into one flow: two boxes → cut wire → write on one side → read on the other → the isolated node hits a fork with no "both" branch. The two branches are CP and AP.

Recall Feynman: retell the whole walkthrough
You and a friend each keep a copy of one scoreboard, connected by a phone line (Step 1). The phone line snaps — you can both still talk to visitors, but not to each other (Step 2). You score a point and change your board to ; you try to phone your friend but the line is dead, so your friend never hears it (Step 3). A visitor asks your friend for the score (Step 4). Your friend has only two moves: shout out the old number (fast, but wrong now) or say "I can't tell you until the phone works" (right, but useless). There is no way to be both fast and right, because your friend simply doesn't know about your new point (Step 5). If you'd never scored, the old number would still be correct — no problem (Step 6). And if the phone were working, your friend would just hear "" and answer correctly — though the phone call itself takes a moment (Step 7). That forced choice, and only when the line is down and the numbers have diverged, is the entire CAP theorem.
Active recall
Why can't the isolated node return the latest write?
What two ingredients together trigger the CAP contradiction?
Why does no row in the Step 5 table satisfy both C and A?
When no client writes during a partition, why is a read still consistent?
On a healthy network, what tension remains and which theorem names it?
Connections
- Parent topic
- Distributed Systems
- ACID vs BASE
- Eventual Consistency
- Replication and Quorums
- PACELC theorem
- Consensus — Paxos & Raft
- NoSQL Databases