CAP Theorem
The CAP theorem states that under network partition a distributed system can satisfy only one of consistency (C) or availability (A); all three cannot hold at once.
Purpose
To reveal the fundamental trade-off of distributed systems and guide data store selection.
Mechanism
Consistency (all nodes see the same view), availability (every request gets a response), partition tolerance (operation continues despite partitions). Since partitions are unavoidable, the practical choice is between CP (strong consistency) and AP (high availability). CP: ZooKeeper, Spanner; AP: Cassandra, DynamoDB.
Use cases
- Distributed storage selection
- Microservice data architecture
- Multi-region deployment strategy
- Consistency vs availability trade-offs
Examples
- Input
During a network partitionOutputChoose C (reject inconsistency) or A (allow it)CP vs AP
Common errors
- Believing all three of CAP can be satisfied simultaneously
- Partitions are unavoidable; choose between CP and AP
Related terms
ACID
ACID is the four properties of relational transactions: atomicity (all or nothing), consistency (constraints preserved), isolation (concurrency without interference), and durability (committed data is never lost). GLOSSARY
BASE
BASE is the weak-consistency NoSQL model: basically available, soft state, eventually consistent — trading strong consistency for availability and scalability. GLOSSARY
NoSQL
NoSQL is the umbrella term for non-relational databases, including document, key-value, column-family, and graph models, designed for scalability and flexible schemas. GLOSSARY