The ‘CAP’ in the CAP theorem
A distributed system can deliver only two of three desired characteristics: consistency, availability, and partition tolerance (the ‘C,’ ‘A’ and ‘P’ in CAP).
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 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.
A 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.