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

  • Consistency (C)
  • Availability (A)
  • Partition tolerance (P)

But what is Consistency, Availability & Partition tolerance? How does it help us to architect better systems? Let’s find out the answers to these questions.

Consistency (C)

A system is consistent when it is able to return the latest data immediately after creation/modification.

Consistent System
Consistent System

In the architecture below, we have 3 databases — one primary and 2 replicas. All writes go to the primary database and synchronously replicated to all replicas. Replicas are…


In computer science, consistent hashing is a special kind of hashing such that when a hash table is resized, only n/m keys need to be remapped on average where n is the number of keys and m is the number of slots

That is Wikipedia definition of consistent hashing! Firstly, who understands Wikipedia definitions? Not many right? So let’s try to break open the definition and see what’s there for us to learn.

Let’s say we want to create a social media website that allow users to share posts. Let’s keep the post as a simple message for now. So…

Swaminathan Muthuveerappan

Software engineer passionate about technology, teaching and management

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