ketama - a consistent hashing algo for memcache clients

Richard Jones rj at last.fm
Tue Apr 10 17:12:14 UTC 2007


On Tuesday 10 April 2007 18:00, Steven Grimm wrote:
> That was actually the next major thing on our memcached to-do list.
> Thanks -- you may have saved us a bit of work there!

Glad to hear it :)
We have an update pending that stores the servers as longs instead of strings, 
and some other cleanup. I'll post a follow up here once we've deployed it.

>
> -Steve
>
> Richard Jones wrote:
> > 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