CAP Theorem
Also known as: Brewer's theorem, consistency availability partition tolerance
The CAP theorem states that when a network partition occurs, a distributed system must choose between consistency (every read sees the latest write) and availability (every request gets a non-error response). It is a statement about behaviour during partitions only — not a menu of three properties from which you pick two.
Last reviewed · Part of the Architecture Glossary
In practice
"Pick two of three" is the popular formulation and it is wrong. Partitions are not a design choice — networks drop packets whether you approve or not. So P is a given, and the theorem reduces to a single conditional: during a partition, do you return possibly-stale data (AP) or an error (CP)?
Two further precisions the shorthand loses:
- The C in CAP is linearizability, not the C in ACID.
- The A in CAP is every non-failing node responding. A system that stays up on the majority side but errors on the minority side is CP, not AP — even though most users saw no outage.
Real systems are also not uniform. The same Cassandra cluster is AP at CL=ONE and CP at CL=QUORUM, per query. The choice belongs to the operation, not the database logo.
When it matters
Multi-region designs, leader-election and locking components (always CP — an available-but-wrong lock is not a lock), and shopping-cart-style paths where accepting a write and reconciling later beats rejecting it.
Common mistake
Using CAP to justify a latency trade-off in the absence of a partition. That is not what the theorem covers — see PACELC, which extends it to the normal case where the network is fine and you are still choosing between consistency and speed.
See also
- PACELCPACELC extends CAP: if there is a Partition, choose Availability or Consistency; Else — when the network is healthy — choose Latency or Consistency.
- LinearizabilityLinearizability is the strongest single-object consistency model: every operation appears to take effect instantaneously at some point between its invocation and its response, and once a write is visible to any client it is visible to all.
- Eventual ConsistencyEventual consistency guarantees only that if writes stop, all replicas eventually converge to the same value.
- Split BrainSplit brain is the state where a network partition leaves two halves of a cluster each believing it is the authoritative one, so both accept writes.