CAP Theorem
CAP stands for Consistency, Availability, and Partition tolerance. The theorem says a distributed system can have only 2 of the 3. A system must pick any 2 and build around them.
Meaning of the word partition
In distributed systems, a partition means some nodes can't talk to each other. The cluster gets split.
- Consistency - Return accurate data when partition happens. If not possible, then return error.
- Availability - Return any data when partition happens. Just ensure the system remains available.
- Partition tolerance - Systems are tolerant to partition and continue to work.
Partition isn't optional.
Most explanations say the system must pick two of C, A, and P.
The right view is different. When P happens, the design must choose between C and A. During a network partition, the system can be consistent or available, not both.
It also means this. If you choose only C and A, the system isn't partition tolerant. And that mostly means it isn't distributed at all.
