MicrolearnENPTES

Consistent hashing

Lesson 14 of 40 · Sys.Micro

Add or remove a node and move only a small slice of keys.

A cache cluster of 3 nodes places keys with hash(key) % 3. Add a fourth node and % 4 sends most keys to a different node. Suddenly ~75% of the cache misses and the database is flooded.

Why hash mod N reshuffles almost everything

The hash ring: walk clockwise to the owner

Check yourself

A cluster with consistent hashing grows from 9 to 10 nodes. Roughly what fraction of keys move?

Do it in the browser: a real system design tool, a short mission and instant feedback. No install.

Start this lesson — free
← ShardingUnique IDs at scale →

All lessons · Sys.Micro