Consistent Hashing Explained: Why Modulo Assignment Reassigns Nearly Every Request

_jaydeepkarale · x · 2026-10-06

A well-structured explainer on consistent hashing in distributed systems.

The problem: naive hash(requestKey) % numberOfServers breaks when server count changes — going from 5 to 4 servers changes the modulo, reassigning nearly every request to a different server.

The fix: consistent hashing places both servers and requests on a ring via a hash function; each request goes to the nearest server clockwise. Removing a server then only reassigns the requests it was serving, leaving all others untouched.

Useful for understanding distributed caching, load balancing, and sharding fundamentals.

Original post →

More from Infra

Infra channel →