CAP Theorem

When we design a distributed system, trading off among CAP is almost the first thing we want to consider. CAP theorem says while designing a distributed system, we can pick only two:


All nodes see the same data at the same time. Consistency is achieved by updating several nodes before allowing further reads.


Every request gets a response on success/failure. Availability is achieved by replicating the data across different servers. ‘

Partition Tolerance

The system continues to work despite message loss or partial failure. A partition-tolerant system can sustain any amount of network failure that doesn’t fail the entire network. Data is sufficiently replicated across combinations of nodes and networks to keep the system up through intermittent outages.

We cannot build a general data store that is continually available, sequentially consistent and tolerant to any partition failures. We can only build a system that has any two of these three properties. Because, to be consistent, all nodes should see the same set of updates in the same order. But if the network suffers a partition, updates in one partition might not make it to the other partitions before a client reads from the out-of-date partition after having read from the up-to-date one. The only thing that can be done to cope with this possibility is to stop serving requests from the out-of-date partition, but then the service is no longer 100% available.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store



Understand the technical details behind all your favorite products. We help you put your best foot forward so you can get through the FAANG door.