Glossary Distributed Systems

Consistent Hashing

A distributed hashing scheme that minimizes key remapping when nodes are added or removed.

What Is Consistent Hashing?

In a traditional hash table, adding or removing a node causes almost all keys to be remapped. Consistent hashing solves this by mapping both nodes and keys onto a circular ring.

How the Ring Works

Each node is assigned a position on a 0–2³² hash ring. A key maps to the first node clockwise from its hash position. Adding a node only remaps keys between the new node and its predecessor.

Virtual Nodes

To avoid uneven distribution (hotspots), each physical node is represented by multiple virtual nodes on the ring. A node with 3x capacity gets 3x virtual nodes.

When to Use It

Use consistent hashing whenever you're distributing load across a dynamically scaling cluster: distributed caches (Redis cluster, Memcached), CDN edge routing, or sharded databases.

Interview Tip

Always mention virtual nodes. Interviewers specifically check whether you understand the load balancing problem with a naive ring.