Skip to main content
Fundamentalschapter 4 of 6 · 4 lessons

CAP Theorem

In a partition, choose: Consistency or Availability. You can't have both.

Your database keeps three copies: one in Virginia, one in Ireland, one in Singapore. At 14:02 the link between Virginia and the other two drops. Not the machines, just the link. All three are running and all three are still taking requests.

Somebody in Ireland changes a price. A second later, somebody in Virginia reads that price.

Now choose. Virginia can hand back the old price, which is wrong, or refuse to answer until the link returns. There is no third option where it answers correctly, because the correct value is on the far side of a broken cable.

That is the whole theorem, and it is not pick two of three. Whichever database you already run has made this choice for you, and most teams cannot say which way it went.

Lessons

4 in this chapter
  1. What C, A, and P Actually MeanEach letter has a precise meaning, and two of them are weaker than they sound.2 min
  2. When the Network SplitsDuring a partition, a node can answer possibly-stale or refuse. There is no third option.2 min
  3. Choosing a Side in PracticeThe right letter depends on what a wrong answer costs versus what no answer costs.2 min
  4. PACELC: The Trade You Make Every DayPartitions are rare. The latency-versus-consistency trade runs every second.2 min