Skip to content

CAP theorem

The CAP theorem states that a distributed system storing shared data can’t guarantee consistency, availability, and partition tolerance all at once. A network failure can split its machines, or nodes, into groups that can’t talk to each other. During such a split, called a network partition, the system has to give up either consistency or availability.

Eric Brewer presented the idea as a conjecture at the 2000 Symposium on Principles of Distributed Computing (PODC), which is why it’s also known as Brewer’s theorem. Seth Gilbert and Nancy Lynch of MIT published a formal proof in 2002. The name is an acronym of the three properties:

  • Consistency: Every read returns the most recent write or an error, as if the data had a single up-to-date copy.
  • Availability: Every request that reaches a working node gets a non-error response, though not necessarily with the latest data.
  • Partition tolerance: The system keeps operating when the network drops or delays messages between nodes.

The popular summary “pick two of three” is misleading. Networks do fail, so a system spread across machines can’t opt out of partitions. The real choice arises only while a partition lasts. A node cut off from its peers can either reject requests to avoid serving stale data, or answer them and risk returning out-of-date results.

The simulator below splits two copies, or replicas, of a value x and shows how a CP system and an AP system each respond while the partition lasts:

Interactive diagram — enable JavaScript to view.

Systems that refuse requests during a partition are often labeled CP, while those that keep answering are labeled AP. AP systems typically rely on eventual consistency, reconciling their replicas once the network heals.

The C in CAP means single-copy consistency, which differs from the C in the ACID guarantees of database transactions. There, consistency means every transaction leaves the data in a valid state that respects the database’s rules. Daniel Abadi’s PACELC theorem extends the idea by noting that even without a partition, a replicated system trades off latency against consistency.

Introduction to MongoDB and Python

Tutorial

Python and MongoDB: Connecting to NoSQL Databases

In this step-by-step tutorial, you'll learn how to use Python to interface with the NoSQL database system MongoDB. You'll get an overview of the differences between SQL and NoSQL, and you'll also learn about related tools, including PyMongo and MongoEngine.

intermediate databases

For additional information on related topics, take a look at the following resources:

Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.


By Martin Breuss • Updated Oct. 25, 2026