DEV Community

Mohini Yadav
Mohini Yadav

Posted on

CAP Theorem

CAP - Consistency, Availability and Partition tolerance

According to CAP theorem, we can achieve any two out of three guarantees in a distributed system.

Consistency - Application will return the most recent write to client.

Availability - Application will return reasonable response in reasonable amount of time.

Partition Tolerance - Application will continue to work even in the case of network partitions

  • Network Partition - It is a scenario in distributed system, when one node is not able to communicate with other node because of network disruption/failure, it divides the network into groups.

There are two options CP and AP.

CP - Consistency/Partition Tolerance
Wait for the response from a partitioned node which could also result into an error response.

Image description

AP - Availability/Partition Tolerance
Application will continue to function with the data it have, it could be a stale.

Image description

Top comments (0)