Tag: ketama

  • scala模拟ketama算法

    ketama是memcached客户端使用的一种一致性哈希算法。是为了解决余数实现分布不均匀的问题,在last.fm的一篇博客中首次提到。这里有一些介绍链接,其中第一篇是原博客。 http://www.last.fm/user/RJ/journal/2007/04/10/rz_libketama_-_a_consistent_hashing_algo_for_memcache_clients http://blog.csdnnet/kangojian/article/details/6708460 http://tech.idv2.com/2008/07/24/memcached-004/ 原博客里面提到算法步骤如下: Take your list of servers (eg: 1.2.3.4:11211, 5.6.7.8:11211, 9.8.7.6:11211) Hash each server string to several (100-200) unsigned ints Conceptually, these numbers are placed on a circle called the continuum. (imagine a clock face that goes from 0 to 2^32) Each number links to the server it was hashed from, so…