The Cap Theorem

The Cap Theorem

Instructor-svgAl-Mamun Sarkar
Sep 18 , 2020

CAP stands for there words Consistent, Available, Partition Tolerant. A distributed database can't have three of these. Menas a database can't have Consistency, Availability, and Partition Tolerant at the same time. A data-only can have any two of these three. So you must have to give up one. According to the use case, we have to choose a database by following site features on the CAP theorem. let's learn more about Consistent, Available, Partition Tolerant.

Consistency:

Every node will always return the most recently written data. So, The data across all nodes have to be the same. Every read operation will receive the most recent write data or an error. Suppose you have a distributed database which has 4 nodes. If you write data to one node and at the same time if someone tries to query data from another node he will not get old data. The system will be locked and he will get the latest data after your update completion. If he gets the latest data then the system is consistent.

Availability:

Every request will receive data without any errors but it's not guaranteed that it will return the most recently written data. Sometimes query can respond to old data but it will not return an error. Suppose you have a distributed database which has 4 nodes. If you write data to one node and at the same time if someone tries to query data from another node he will get old data. When every node will be updated then you will get updated data from another node. Unlike consistency, it will not return an error response. So in the availability system some moment you might get old data but the system will not be locked,

Partition Tolerant:

The system has to be running even it gets some network problems. If the system can't connect any node it has to work properly. If it doesn't work the database system does not partition tolerance.

Among these three features partition tolerance in most important for a distributed database. So partition tolerance is a must-have feature for a distributed database. You have to choose either availability or consistency with partition tolerance.  

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram