consistent hashing: in Perl, standards

Brad Fitzpatrick brad at danga.com
Wed Apr 25 02:36:31 UTC 2007


Back in August I posted some consistent hashing code.  I finally got
around to putting it into a Perl library recently:

   http://search.cpan.org/~bradfitz/Set-ConsistentHash/

But with some of the alternatives springing up, it might be a good time to
discuss some standard consistent hashing strategies, for inter-language
interop (when sharing the same set of memcached server using different
client libraries/languages), in the same way we all agreed to use
certain bits out of crc32 back in the day.

And let me predeclare that I don't claim my implementation to be the
best... it might have bugs, or there might be better ways to do stuff.
But it was my testbed for testing how things distributed on failures, and
I made sure it was fast (it precomputes the node selection for 1024 points
on the circle, so the common case is an array lookup on, say,
crc32($your_key) % 1024, rather than doing the full lookup every time...)

Anybody care to lead this discussion?  I just wanted to kick-start it. :)

- Brad



More information about the memcached mailing list