The CAP theorem
medium 28 minWhen the network between copies of your data breaks, each copy must either refuse some requests or risk answers that disagree.
Remember it
The few things worth knowing cold, and how to make them stick.
Memory hook
When the link breaks: refuse, or risk it.
Two islands share one guest book. When the raft cable breaks, close one book or let the books differ and merge them later.
Cheat sheet
- C
- linearizability: one copy
- A
- every working node answers
- P
- messages may be lost: given
- Majority
- floor(N / 2) + 1
- CP
- banks: correct even if closed
- AP
- social: loads even if old
- PACELC
- else latency or consistency
- Nines
- 99.9% = 8.76 h a year
Spot it when you see
- Writes in two regions.
- The words never stale and always up in one sentence.
- A cluster with leader election.
Tricks that stick
- C: the same data everywhere. A: always responds. P: survives a split.
- P is given, so the question is CP or AP.
- Two majorities always meet.
Do not forget
- Saying pick two of three.
- Mixing CAP's C with ACID's C.
- Calling a brand CP without its settings.
- Choosing AP without a merge rule.
- Thinking four nodes survive more than three.