🌱 Tim's Dev Wiki

Search IconIcon to open search

CAP Theorem

Last updated January 5, 2023.

CAP theorem states that a distributed system can only have 2 of the following hold true:

  1. Consistency — every node has the most recent data. I.e. if you pick any node, you will see all of them report the same data.
  2. Availability — every request is fulfilled.
  3. Partition tolerance — the system continues operating when some nodes can’t communicate with each other.
    • A network partition is when the communication between nodes break down and form two separate networks.

Put simply, the CAP theorem states that when a network partition happens, you must choose either consistency or availability, but never both, until the network partition is resolved.