๐จ โRedis Cluster uses consistent hashingโ
Thatโs what most people say.
But is it really true? ๐ค
I was thinking about this recentlyโฆ
In consistent hashing:
๐ Adding a node โ minimal data movement
But in Redis:
๐ We have 16384 slots
๐ When a new node is added
๐ We rebalance slots across nodes
๐ก Which means:
๐ A significant number of slots can move
๐ Sometimes from multiple nodes
So the question is ๐
โ Is Redis really doing consistent hashing?
โ Or is it just controlled sharding?
๐ก Reality:
Redis Cluster uses:
๐ Hash Slots (not a ring)
๐ CRC16(key) % 16384 โ slot โ node
So whatโs the difference?
๐น Consistent Hashing โ minimizes movement mathematically
๐น Redis Slots โ controls movement operationally
๐ง Real insight:
Redis is not optimizing for:
๐ โminimum movementโ
Itโs optimizing for:
๐ โmanageable and predictable rebalancingโ
โ You can move slots gradually
โ You can rebalance manually
โ No full system rehash
๐ Thatโs why Redis chose slots over a ring
๐ก Final thought:
๐ Consistent hashing = elegant theory
๐ Redis slots = practical engineering
Curious to hear your thoughts ๐
Do you consider Redis Cluster as consistent hashing or sharding?
Want to go deeper into System Design?
๐ธ Follow on Instagram for quick tech content:
Follow for more on AI, Java & System Design ๐
#SystemDesignย #Redis #ConsistentHashingย #DistributedSystems #Scalability #BackendDevelopment #Java #Developers #Tech