--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
What is the class for doing consistent hashing in Jedis? I read ShardedJedisTest.java & ShardedJedisPoolTest.java but didn't find 'consistent hashing'. Does that mean in current version of Jedis, consistent hashing is the only sharding method?
Anyway, I did want to see how "consistent hashing" works in Jedis. So, I started 2 redis servers at local host, one at 6379 and the other at 6380. Then, I started 2 redis clients, connecting to these two servers respectively and issued "monitor" to watch for requests on both servers. I expected that key-value pairs be evenly distributed among two servers. But it showed that the server at 6379 got much more data than server at 6380. This may not indicate a problem since the keys used in test might be biased in terms of the hashing function used. But want to check if this is the case and more evenly distributed key-value pairs among servers will be seen when data size grows.
You just got lucky (or unlucky) with your data set. Assuming your
hashing algorithm has features consistent with H(key) -> all outputs
equally likely, then it should place N items into K buckets at a
distribution more or less equivalent to inserting those same items
into K random buckets. Given that, "hot buckets" should be at most 2x
the size of the "average" N/K size buckets with high probability (1 -
1/N if I remember the class I took some 7-8 years ago), with the odds
of even one bucket exceeding that having probability 1/N.
MD5 has sufficient qualities to be roughly equivalent to a random
distribution for keys that weren't crafted to attack it, so should
have had (within a factor of 2) the same distribution of any other
"good" function.
Regards,
- Josiah