AlgoPlus//structures / sharding
Read the theory

Sharding · Consistent Hashing

Spread data across nodes on a ring so adding capacity moves as few keys as possible.

Keys moved
0
Legend
Server / its keys
Lookup walk
Re-homed key
AI Tutor Workspace
In a nutshell
When one database grows too big for a single machine, you split it into pieces — shards — each on its own server. The hard part is deciding which record lives on which server without reshuffling everything every time you add capacity. Consistent hashing places both servers and records on a ring, and a record belongs to the next server clockwise. Add a server and only the records in one arc move — about one server's share — instead of nearly all of them.
Ready
Press play to begin the cinematic walkthrough.
Consistent hashing puts servers and keys on a ring; a key belongs to the next server clockwise. Adding a server steals keys from just one neighbour, so scaling out doesn't reshuffle everything.
Key terms
Go deeper in the lesson
Read the full theory, intuition & complexity for Sharding · Consistent Hashing.