what is cap theorem

what is cap theorem

1 year ago 42
Nature

The CAP theorem, also known as Brewers theorem after computer scientist Eric Brewer, is a concept in theoretical computer science that states that any distributed data store can provide only two of the following three guarantees: consistency, availability, and partition tolerance. Here are the definitions of these guarantees:

  • Consistency: Every read receives the most recent write or an error. In other words, all nodes in the network see the same data at the same time.

  • Availability: Every request receives a (non-error) response, without the guarantee that it contains the most recent write. In other words, even if one or more nodes are down, any client making a data request receives a response.

  • Partition tolerance: The system continues to operate despite an arbitrary number of messages being dropped (or delayed) by the network between nodes. In other words, the system can handle network failures and still function.

According to the CAP theorem, when a network partition failure happens, it must be decided whether to prioritize consistency or availability. In other words, if there is a network partition, one has to choose between consistency or availability. Its important to note that consistency as defined in the CAP theorem is quite different from the consistency guaranteed in ACID database transactions.

The CAP theorem is relevant for designing distributed systems, including cloud applications, because it helps system designers understand the trade-offs involved in designing networked shared-data systems. Different NoSQL databases provide different combinations of consistency, availability, and partition tolerance, and understanding the CAP theorem can help choose the best database for a given application.

Read Entire Article