The CAP Theorem
The CAP Theorem
The CAP Theorem
Availability –
Availability means that each read or write request for a data item will
either be processed successfully or will receive a message that the
operation cannot be completed. Every non-failing node returns a response
for all the read and write requests in a reasonable amount of time. The key
word here is “every”. In simple terms, every node (on either side of a
network partition) must be able to respond in a reasonable amount of
time.
Partition Tolerance –
Partition tolerance means that the system can continue operating even if
the network connecting the nodes has a fault that results in two or more
partitions, where the nodes in each partition can only communicate among
each other. That means, the system continues to function and upholds its
consistency guarantees in spite of network partitions. Network partitions
are a fact of life. Distributed systems guaranteeing partition tolerance can
gracefully recover from partitions once the partition heals.
The use of the word consistency in CAP and its use in ACID do not refer to the same
identical concept.
In CAP, the term consistency refers to the consistency of the values in different
copies of the same data item in a replicated distributed system. In ACID, it refers to
the fact that a transaction will not violate the integrity constraints specified on the
database schema.
The CAP theorem states that distributed databases can have at most two of the three
properties: consistency, availability, and partition tolerance. As a result, database
systems prioritize only two properties at a time.
The following figure represents which database systems prioritize specific properties
at a given time: