CAP theorem
Under a network partition, you pick consistency or availability. Outside partitions, you trade latency for consistency (PACELC).
CAP says when the network partitions, you choose between consistency and availability. That is the whole theorem. You cannot have both because nodes on either side of the split cannot talk, so either you stop serving writes (CP) or you serve them and diverge (AP).
Partition tolerance is not optional. Networks fail. If your system runs on more than one machine, you must handle partitions. So the real choice is C vs A during a partition.
What the letters actually mean
- C: linearizability. Every read sees the latest write. Not "eventually consistent." Not "read your writes." Strict single-copy semantics.
- A: every non-failing node returns a non-error response. Not "99.99% uptime." Every node, every request, no exceptions.
- P: the system keeps working when messages between nodes are dropped.
This is why CAP is narrower than people think. Most production systems are neither strictly C nor strictly A by Brewer's definition.
PACELC is the better framing
Daniel Abadi extended CAP: if Partitioned, choose A or C. Else (normal operation), choose Latency or Consistency.
- DynamoDB: PA/EL (available under partition, low latency in normal ops).
- Spanner: PC/EC (consistent always, pays latency cost via TrueTime).
- Cassandra: PA/EL by default, tunable per query.
PACELC matters more in interviews because it forces you to talk about the 99.9% case, not just the failure case.
The interview answer
If asked "is X CP or AP?": "It depends on the operation. By default Cassandra is AP and eventually consistent, but with QUORUM reads and writes on a 3-node cluster you get strong consistency at the cost of availability during partition. Most real systems let you tune per call."
If asked "why can't you have all three?": "Two nodes can't agree on the latest value if they can't exchange messages. So during a partition, either you refuse to answer (lose A) or you answer with possibly stale data (lose C). The third option, refusing to handle partitions, is not a real option in production."
Learn more
- ArticleDesigning Data-Intensive Applications, Chapter 9Martin Kleppmann
- ArticlePlease stop calling databases CP or APMartin Kleppmann
- DocsPACELC theoremWikipedia