Skip to content
BENIBIX Learn

CAP Theorem

Development🏗️ ArchitectureDistributed Systems

Also known as CAP, Brewer's Theorem, Consistency Availability Partition Tolerance

When a network splits, a system must give up one of two things.

Think of it like

Think of it like two shop tills that lose their link. Either they stop selling, or they risk selling the last item twice.

Example

Lucy's bank app loses the link between its two data centers. It picks C over A. Some customers see an error for a minute, but no balance is ever wrong.

Why it matters

It explains why some databases refuse writes in a crisis. Others take them and fix things up later.

Definition

The CAP theorem is about what a system on many machines can promise when its network splits. C is consistency: each read sees the latest write. A is availability: each request gets an answer. P is partition tolerance: the system keeps going through a split. No system can promise all three at once. Since splits do happen, the real choice in one is C or A.

Common mistake

Reading it as pick any two of three. Splits are not optional, so when one happens the choice is C or A.

Key takeaways

  1. 1
    Consistency. Every read is up to date.
  2. 2
    Availability. Every request is answered.
  3. 3
    Choose during a split. You cannot have both.