What is consistent hashing and how does it compare to Redis Cluster's approach?
Answer
Consistent hashing places both nodes and keys on a conceptual ring. Each key is assigned to the nearest node clockwise on the ring. When a node is added or removed, only the keys on one segment of the ring are remapped — O(K/N) keys on average, rather than remapping all keys. This minimizes data movement on topology changes. Redis Cluster uses a different approach: fixed hash slots assigned to nodes. When a node joins, an administrator explicitly migrates a subset of slots to it. This gives more predictable, operator-controlled data distribution. The tradeoff: consistent hashing is more self-organizing; Redis Cluster's slot model is more explicit and compatible with the CRC16 + modulo calculation that all clients implement deterministically. Redis intentionally chose fixed slots over consistent hashing for simpler, auditable behavior and to enable hash tags for key co-location.
Previous
How does Redis Cluster sharding and the hash slot algorithm work in detail?
Next
What is memory optimization in Redis (ziplist, listpack, and encoding thresholds)?
More Redis Questions
View all →- Advanced How does Redis Cluster sharding and the hash slot algorithm work in detail?
- Advanced What is memory optimization in Redis (ziplist, listpack, and encoding thresholds)?
- Advanced How does AOF rewrite work and how does it compare to RDB performance?
- Advanced What are Redis Functions (replacing Lua scripts in Redis 7+)?
- Advanced What is Redis Stack and what does it add to vanilla Redis?