You Can't Have All Three — The Constraint That Defines Distributed Systems
In 2000, computer scientist Eric Brewer proposed what became known as the CAP theorem: in a distributed data system, you can have at most two of three desirable properties — Consistency, Availability, and Partition Tolerance. You cannot have all three simultaneously.
This was formalized as a proof in 2002. Since then it has shaped how every large-scale internet system is designed. Not as a nice-to-have — as a hard constraint.
The three properties
Consistency (C): Every read receives the most recent write or an error. If you write a value and then immediately read it from any node in the system, you get that value. The system behaves as if it were a single node, even if it's running on thousands of machines.
Availability (A): Every request receives a response — not an error, a real response, even if the data might not be the most recent version. The system keeps responding even if some nodes are degraded.
Partition Tolerance (P): The system continues operating even if network communication between some nodes is lost or delayed. A partition is a network split — some nodes can no longer talk to others. A partition-tolerant system survives this and keeps working.
Why you can't have all three
Imagine two database nodes, Node A and Node B, storing the same data. A user writes a new value to Node A. Before Node A can replicate this to Node B, the network link between them fails — a partition occurs.
Now another user reads from Node B. What happens?
- If you prioritize Consistency: Node B must either return the new value (which it doesn't have yet) or an error. It returns an error. You've sacrificed Availability.
- If you prioritize Availability: Node B returns whatever it has — the old value. You've sacrificed Consistency.
There is no third option. The partition is real; you must choose which property to give up.
Why partition tolerance isn't optional in practice
In a real distributed system — anything running on multiple machines connected by a network — partitions happen. Networks fail, cables are cut, routers crash, data centers lose connectivity. You cannot build a distributed system that is immune to partitions; you can only choose how to respond when they occur.
This means the practical choice is almost always between CP (Consistency + Partition Tolerance) or AP (Availability + Partition Tolerance). CA — Consistency + Availability — requires a system that never experiences a partition, which means a single node, not a distributed system.
Real systems and their choices
CP systems prioritize consistency over availability. Traditional relational databases (PostgreSQL, MySQL in strict configurations) and systems like HBase and Zookeeper lean this way. During a partition, they'd rather reject a request than serve stale data. Banks and financial systems often want this: it's better to tell a customer "service temporarily unavailable" than to show them an incorrect account balance.
AP systems prioritize availability over strict consistency. DynamoDB (in eventual consistency mode), Cassandra, and CouchDB lean this way. They'll serve slightly stale data rather than reject requests. A social media feed that shows a post from 30 seconds ago instead of 5 seconds ago is tolerable — a feed that's unavailable is not.
The refinement: PACELC
The CAP theorem describes behavior during partitions, but a partition is an abnormal state. Daniel Abadi proposed PACELC as an extension: even when there's no partition, you still face a tradeoff between Latency and Consistency. A system can write to all replicas synchronously (high consistency, higher latency) or write to one and propagate asynchronously (lower latency, eventual consistency). This is the tradeoff that dominates normal operation.
Systems like DynamoDB let you configure where on the spectrum you want to sit. Read-your-own-writes consistency is a common middle ground: you'll always see your own most recent write, but other users might see a slightly older state.
The broader lesson
CAP theorem is a specific technical result, but its deeper lesson applies everywhere: in complex systems with multiple independent actors, you cannot optimize every desirable property simultaneously. Adding redundancy improves availability but introduces consistency challenges. Optimizing for speed sacrifices some safety. Decentralizing for resilience creates coordination costs.
The discipline of distributed systems design is fundamentally about making explicit, reasoned tradeoffs rather than hoping to avoid them. Most failures in software architecture — and in organizational design — come from assuming you can have all three.
Quick answers
What is CAP Theorem?
CAP theorem proves that any distributed data system must sacrifice either consistency, availability, or partition tolerance — you pick two.
Where does this concept come from?
The concept originates with Eric Brewer (CAP theorem, 2000 PODC keynote); formalised by Gilbert & Lynch (2002).