The Law of Distributed Systems
In a perfect world, our databases would be fast, never go down, and always have the right data. But the CAP Theorem proves that in a distributed system, you can only pick two out of three.
Breaking Down C-A-P
- Consistency (C): Every reader gets the most recent write or an error.
- Availability (A): Every request receives a (non-error) response, without the guarantee that it contains the most recent write.
- Partition Tolerance (P): The system continues to operate despite an arbitrary number of messages being dropped or delayed by the network between nodes.
The "P" is Not Optional
In the real world, networks fail (Partitions happen). Therefore, for any distributed system, you must choose Partition Tolerance. This leaves you with a binary choice when a network failure occurs:
- Do you choose CP (Consistency over Availability)?
- Do you choose AP (Availability over Consistency)?

Top comments (0)