CAP Theorem
ReliabilityAlso known as: Brewer's theorem
The CAP theorem states that a distributed data system can simultaneously provide only two of three guarantees: Consistency (all nodes see the same data), Availability (every request receives a response), and Partition tolerance (the system operates despite network failures).
Formulated by Eric Brewer in 2000, the CAP theorem is a fundamental principle for reasoning about distributed systems. Since network partitions are inevitable in distributed systems, the practical choice is between consistency and availability during a partition.
CP systems (Consistency + Partition tolerance) refuse to serve requests rather than return stale data during a partition. Examples include HBase, MongoDB (in its default configuration), and ZooKeeper.
AP systems (Availability + Partition tolerance) continue serving requests during a partition, accepting that some responses may be stale. Examples include Cassandra, DynamoDB, and CouchDB.
In practice, the CAP theorem is a spectrum rather than a binary choice. Modern systems offer tunable consistency — for example, Cassandra lets you configure consistency level per query. The PACELC extension adds that even without partitions, there is a trade-off between Latency and Consistency.
In system design interviews, reference CAP when justifying your database choice and explaining how your system handles failure scenarios.
Related Terms
Ready to design?
Practice using cap theorem in a real system design on Supaboard's interactive whiteboard.
Browse Challenges