CAP Theorem

The ‘CAP’ in the CAP theorem

A distributed system can deliver only two of three desired characteristics: consistencyavailabilityand partition tolerance (the ‘C,’ ‘A’ and ‘P’ in CAP).

Consistency

Consistency means that all clients see the same data at the same time.

In the example above, we have 2 different records (“Bulbasaur” and “Pikachu”) at different timestamps. The output on the third partition is “Pikachu”, the latest input. However, the nodes will need time to update and will not be Available on the network as often.

Availability

Availability means that that any client making a request for data gets a response, even if one or more nodes are down. 

Unlike the previous example, we do not know if “Pikachu” or “Bulbasaur” was added first. The output could be either one. Here does not obey Consistency.

Partition Tolerance

partition is a communications break within a distributed system—a lost or temporarily delayed connection between two nodes. Partition tolerance means that the system must continue to work despite any number of communication breakdowns between nodes in the system.

Partition Tolerance is not an option. It’s a necessity. We have to trade between Consistency and Availability.

References:

Author: huadonghu

Leave a Reply

Your email address will not be published. Required fields are marked *