ketama - a consistent hashing algo for memcache clients

Christian Muehlhaeuser muesli at
Wed Apr 11 04:27:24 UTC 2007

Hey memcached-ml!

Introduction first: my name is Christian Muehlhaeuser (or muesli) and
I'm working with RJ (Richard Jones) on ketama, which he just announced
here recently.

I thought I should post a little install howto and add some notes
about known issues / my current TODOs. Also, if you happen to find a
bug in ketama, please mail us! Patches are always welcome as well, of
course ;-)

First of all, please note that I just updated the tarball, so please
redownload it from here:


* libketama (the general purpose C library)

$ cd libketama
$ make
$ su -c "make install"

This will compile libketama and install it to the default prefix /usr/local.
You can change the prefix by editing the PREFIX variable in 'Makefile'.

* php_ketama (PHP4 extension that wraps libketama and therefore depends on it)

$ cd php-4.4.x/ext
$ ln -s /your/ketama/php_ketama ketama
$ cd ..
$ rm -Rf autom4te.cache
$ ./buildconf --force
$ ./configure --all_your_configure_options --with-ketama[=/your/ketama/prefix]
$ make
$ su -c "make install"

Don't forget you might have to restart your httpd!


* It's a known issue that libketama might crash (in ketama_roll) if
the server definitions file doesn't follow the formatting standards
("ip:port_\t_unsigned integer_\n", without the underscores and
quotes). This currently got the highest priority on my TODO list and
will be fixed in the next release. Sorry about that.

* Instead of storing the servers as a char[22] in the continuum, we
will start using sockaddr_in / in_addr. This also allows us to easily
check for validity of a sever address.


More information about the memcached mailing list