Consistent Hashing
maang.io System Design Series
Consistent hashing maps both keys and nodes onto the same circular hash space, so each key is owned by the next node clockwise. Its superpower: when a node joins or leaves, only the keys in its immediate arc move β roughly 1/N of the data β instead of the near-total reshuffle that plain hash % N inflicts. It's the distribution engine inside Cassandra, DynamoDB, memcached clients, and CDNs.
This deep dive comes in three parts:
- Foundations & Core Concepts β the ring, clockwise ownership, and why
hash % Nfalls apart. - Internals β virtual nodes for balance, remapping math, and bounded-load variants, with worked numbers.
- Interview β Staff/Principal Q&A: rebalancing, hot spots, and where it shows up in real designs.
Consistent Hashing β Part 3: System Design & Interview Mastery
maang.io System Design Series
What is this?
You now know the ring from the rim down to the virtual nodes. This chapter is where that knowledge earns the offer. Interviewers don't want you to recite "consistent hashing minimizes remapping" β they want to watch you reach for the ring at the right moment, size it, and defend it when they push on hot keys, replication, and the alternatives. That's the difference between a memorized fact and a senior signal.
We'll do two things: see where the ring shows up in real designs, then run a mock interview β for each question, what they're really asking, a model answer, and the senior line that says you've done this for real. The hotel lobby from Parts 1 and 2 is still with us: concierges on a circle, guests walking clockwise, name badges (virtual nodes) spreading the crowd.
The one-line idea: interviewers use consistent hashing to test whether you understand that in an elastic distributed system, the expensive event isn't the steady state β it's the membership change, and the whole game is making that change move as little data as possible while keeping load even.
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson