CAP Theorem: How a distributed system can provide C + A without P?

The CAP theorem, also known as Brewer’s theorem, states that it is impossible for a distributed computer system to simultaneously provide all three of the following guarantees:

  • Consistency – all nodes always give the same result.
  • Availability – a guarantee that nodes always answer queries and accept updated.
  • Partition tolerance – system continues working even if one or more nodes become silent or not responsive.

A distributed system can satisfy any two of the above guarantees at the same time but not all three.

But I am confused after came through a scenario that how a distributed system can give atomic consistency and perfect availability without  partition tolerance in a distributed system. We cannot, however, choose both consistency and availability in a distributed system.

As a thought experiment, imagine a distributed system which keeps track of a single piece of data using three nodes—A, B, and C—and which claims to be both consistent and available in the face of network partitions. Misfortune strikes, and that system is partitioned into two components: {A,B} and {C}. In this state, a write request arrives at node C to update the single piece of data.

That node only has two options:

  1. Accept the write, knowing that neither A nor B will know about this new data until the partition heals.
  2. Refuse the write, knowing that the client might not be able to contact A or until the partition heals.

You either choose availability (option #1) or you choose consistency (option #2). You cannot choose both.

To claim to do so is claiming either that the system operates on a single node (and is therefore not distributed) or that an update applied to a node in one component of a network partition will also be applied to another node in a different partition component magically.

This is, as you might imagine, rarely true.

So the answer is, Consistency, Availability, and Partition Tolerance are the Platonic ideals of a distributed system–we can partake of them enough to meet business requirements, but the nature of reality is such that there will always be compromises.

Leave a comment