banner image 1 banner image 2

CAP Theorem

May 9, 2022
2 mins
blog-img 1
Ajay Paul

CAP Theorem for Distributed Systems

By Ajay Paul- “Code maker-Code breaker.”

CAP theorem for distributed system states that it is impossible for a distributed data store to simultaneously provide more than two out of the following three guarantees:

For nodes N1 and N2, each having values V1, client C calls the node N1 and updates the value from V1 to V2. Client D wants to access this value from the Node N2, for this to happen, node N1 has to replicate the new value V2 to node N2.
  • Consistency: Every read receives the most recent write or an error.
  • Availability: Every request receives a (non-error) response, without the guarantee that it contains the most recent write.
  • Partition tolerance: The system continues to operate despite an arbitrary number of messages being dropped (or delayed) by the network between nodes

Consistency is only possible by replicating all data to all nodes before it is read again but for that to happen, we have to prevent any further reads till all nodes are updated, so availability takes a hit.
If the system is to be made available, we need to allow clients to read data, including stale data from any node before the consistency goal is achieved.

Partition tolerance is total communication breakdown(i.e dropped partitions, slow network connections, or unavailable network connections between nodes.) between nodes which is extremely rare, a delayed sync between nodes can be termed as such, which however is limited to that specific time only. In ideal situations, storage provides all three features, But the CAP theorem maintains that when a distributed system causes a network failure, either consistency or availability can be provided as a tradeoff. All other times, all three can be provided. But, in the event of a network failure, a choice must be made.

In reality, partition tolerance is a must. Any distributed system, by nature, operates with network partitions. Network failures will happen, so to offer any kind of reliable service, partition tolerance is necessary — the P of CAP.
So CAP theorem is simply Consistency vs Availability and not any of two out of three.


Meet the team!

Ajaypaul A

Mridula Saravanan

We at CaratLane are solving some of the most intriguing challenges to make our mark in the relatively uncharted omnichannel jewellery industry. If you are interested in tackling such obstacles, feel free to drop your updated resume/CV to!
blog-img 2


blog-img 3
5 mins
May 17, 2023
Sharing Data Between Controllers: Best Practices S...

This article will help you to understand the diffe

By Naveen C

blog-img 3
5 mins
March 21, 2023
Understanding Auto Layout and Constraints in Swift...

This article gives you an easy way of understandin

By Ramasamy P