CAP Theorem
The Theorem
In a distributed system, you can only guarantee two out of these three properties:
Consistency (C)
All nodes see the same data at the same time. Every read receives the most recent write.
Availability (A)
Every request receives a response (success or failure). System remains operational.
Partition Tolerance (P)
System continues to operate despite network failures or message loss between nodes.
CAP Theorem Interactive Visualization
Click on combinations or systems to explore trade-offs in distributed systems
Why Only 2 of 3?
In a distributed system with network partitions (P is unavoidable in real networks), you must choose between:
- CP: Reject writes during partition to maintain consistency (sacrifice availability)
- AP: Accept writes on both sides of partition, deal with conflicts later (sacrifice consistency)
Note: CA systems are essentially non-distributed systems (single-node or tightly-coupled clusters)