Implements consistent hashing in Python (using md5 as hashing function). Implements consistent hashing that can be used when the number of server nodes can increase or decrease (like in memcached). The hashing ring is built using the same algorithm as libketama. Consistent hashing is a scheme that provides a hash table functionality in a way that the adding or removing of one slot does not significantly change the mapping of keys to slots. More about hash_ring can be read in a blog post (that explains the idea in greater details): Consistent hashing implemented simply in python < http://amix.dk/blog/viewEntry/19367 >
I've bumped into consistent hashing a couple of times lately. The paper that introduced the idea ( Consistent Hashing and Random Trees: Distributed Caching Protocols for Relieving Hot Spots on the World Wide Web by David Karger ) appeared ten years ago, although recently it seems the idea has quietly been finding its way into more and more services, from Amazon's Dynamo to memcached (courtesy of Last.fm ).
Next up in the toolbox series is an idea so good it deserves an entire article all to itself: consistent hashing. Let’s say you’re a hot startup and your database is starting to slow down.