ketama - a consistent hashing algo for memcache clients

Richard Jones rj at last.fm
Tue Apr 10 16:56:14 UTC 2007


Every time we added memcached servers to the pool, the rehashing of all keys 
would kill our database while the cache filled up again. We implemented a 
consistent hashing algorithm that our memcached clients are now using to map 
keys to servers. Now we can add new memcached servers without causing 
chaos :)

Here is the blurb and the code:
http://www.last.fm/user/RJ/journal/2007/04/10/392555/

Source download includes:
 libketama, a c library
 php_ketama, a php extension that uses the library
 a pure java implementation

I'm interested in other approaches (or even if this is a concern for most 
people?). I read about the lots-of-virtual-buckets concept, but didn't find 
an implementation. Anyone already using consistent hashing for memcache?

RJ

-- 
Richard Jones
Last.fm Ltd. | http://www.last.fm/
Office: +44 (0) 207 780 7080
Mobile: +44 (0) 7740 194 389


More information about the memcached mailing list