Why can't a system spread across the world be both always consistent and always available?
When the network between two copies of your data breaks, a system must choose: answer with possibly stale data, or refuse to answer.
▶ Start the storyBecause networks break, and when the link between two copies of your data is cut, the copies cannot compare notes. The CAP theorem, also named Brewer's theorem after Eric Brewer, says a can provide at most two of three guarantees: consistency, availability and tolerance. Consistency means every read receives the most recent write, or an error. Availability means every request to a working gets a response, without a guarantee it holds the latest data. Partition tolerance means the system keeps operating even when the network drops or delays messages between nodes.
No distributed system is safe from network failures, so partitions generally have to be tolerated, which leaves two options. When a happens, a system can cancel the operation, lowering availability but ensuring consistency, or proceed, providing availability but risking inconsistency. Say you save a change on one side of a cut network and someone reads it on the other. The system can only return an error or return the old value.
Step 1: Two copies of the data
In two places, kept in sync by messages
Step 2: The network between them fails
A : messages are dropped or delayed
Step 3: A write reaches only one copy
The other copy is now out of date
Step 4: The system must choose
Return an error, or answer with the old value
Notice the limit of the claim. In the absence of a , both availability and consistency can be satisfied. Brewer himself clarified in 2012 that "two out of three" can be misleading: designers only need to sacrifice one of them in the presence of partitions, and partition management and recovery techniques exist.
The idea has a founder with a story. Brewer says the theorem first appeared in autumn 1998, and he presented it as a at a major conference in 2000. In 1996 he had co-founded Inktomi and became a paper billionaire during the dot-com bubble. In 2002 Seth Gilbert and Nancy Lynch of MIT published a formal proof, which elevated the conjecture to a theorem.
Quiz me
0/3
Recap
When the network splits, you must choose: refuse to answer (consistent) or answer possibly stale (available).
💡 A trick to remember it · Two friends with one notebook and a cut phone line: either "I can't say" or "here's what I last knew".
Surprising fact · Without a partition, a system can have both consistency and availability.
Connects to
- 🗳️ How do computers agree on anything when some of them crash?
- ⚖️ How does a website spread millions of visitors across machines?
- ☸️ How does Kubernetes keep thousands of containers running?
- 🧰 Why did Amazon and Google build databases without tables?
- 🧱 Why can one company's bad day take down so much of the web?
- ⛓️ How does Bitcoin stop anyone from spending the same coin twice, with no bank in charge?
Sources (3)
No source, no claim. Every fact in this lesson (15 claims) cites at least one of these.