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.