The CAP Theorem states that a distributed system can only guarantee two of the following three properties:
The Three Properties
- Consistency (C): Every read sees the latest write
- Availability (A): Every request receives a response (success or failure)
- Partition Tolerance (P): System continues to operate despite network partitions
The Real Tradeoff
In practice, Partition Tolerance is non-negotiable in distributed systems - network failures will happen. This means the real tradeoff is between:
- CP (Consistency + Partition Tolerance): Sacrifice availability during partitions
- AP (Availability + Partition Tolerance): Sacrifice consistency, use eventual consistency
Examples
- CP Systems: Traditional relational databases, coordination services (Zookeeper, etcd)
- AP Systems: Cassandra, DynamoDB, DNS