when new shard added or one shard removed then those keys will be point to new shard. But data was stored in removed hash. Wouldn’t there will be miss for all keys which are stored in removed key?
When new shard added or one shard removed then those keys will be point to new shard. But data was stored in removed hash. Wouldn't there will be miss for all keys which are stored in removed key?
Yeah. All the keys of lost VM will be missed. But still, the miss keys ratio is very less as compared to all the keys.
Suppose, you have 1000 keys and 5 VMs. And you have uniformly distributed those keys over the VMs. Then each VM will be handling 200 keys.
Now if one VM is down. Then 1000 keys will be handled by 4 VMs. So each VM will be handling 250 keys.
If you use consistent hashing then only 200 keys need to be remapped instead of all 1000 keys in old fashion technique. This number will even reduce more if you increase the number of VMs in the cluster.
Another thing is If you are maintaining the replication factor of supposing 2 or 3. Then even those 200 keys will also not get miss because the keys will be replicated in the next coming server in the ring.
I hope I have answered your doubt.