System design · Mechanisms — replication, queues, limits, and placement

Consistent hashing, and why `hash % N` breaks on the day you scale

Placing a key on a machine looks like a one-line problem until the machine count changes. This measures how much data `hash % N` moves when you add a node, builds the ring that fixes it, shows why the ring is lumpy without virtual nodes, and names what consistent hashing still does not solve.

24 min read Full lesson in the app Patterns: consistent-hashing, virtual-nodes, hot-key

What you'll be able to do

Before this: picking-a-datastore

The rest of this lesson is in the app

Placing a key on a machine looks like a one-line problem until the machine count changes. This measures how much data `hash % N` moves when you add a node, builds the ring that fixes it, shows why the ring is lumpy without virtual nodes, and names what consistent hashing still does not solve. This walkthrough runs about 24 minutes, with runnable code you can edit and re-run as you read.

Continue in ChannelPulse

The first module of every track is free to read on the web — see what's open in System design.