Interview concept

What is consistent hashing?

Consistent hashing maps both keys and servers onto a ring so that adding or removing a server only reassigns a small fraction of keys, unlike a plain modulo hash that remaps almost everything.

Interview concept

How it works

The hash ring

Keys and nodes are hashed onto a ring; each key belongs to the next node clockwise.

Virtual nodes

Each physical node maps to many ring points to balance load and smooth rebalancing.

When to use it

It underpins distributed caches, databases, and load balancers that scale nodes up and down.

Interview concept

Responsible use

Use any live AI assistant only where interview, workplace, school, and platform rules allow it. Do not use generated answers to misrepresent your skills, experience, or authorship.

FAQ

Common questions.

Why not just use modulo hashing?

Modulo by server count remaps almost all keys when the count changes; consistent hashing moves only a small fraction.

What are virtual nodes?

Virtual nodes give each server multiple positions on the ring to balance load and reduce hotspots.