Skip to content
A Consistent Hashing implementation for Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
LICENSE
README.rdoc
Rakefile
VERSION

README.rdoc

ConsistentHashr

A small module to do easy consistent hashing.

Usage

ConsistentHashr.add_server(“s1”, “server1”) ConsistentHashr.add_server(“s2”, “server2”) ConsistentHashr.add_server(“s3”, “server3”) ConsistentHashr.add_server(“s4”, “server4”) ConsistentHashr.add_server(“s5”, “server5”)

ConsistentHashr.get(key) # Should return the same key consistently when new servers are added.

Implementation

Based on “Mike Perham's”:www.mikeperham.com/ “code”:www.mikeperham.com/2009/01/14/consistent-hashing-in-memcache-client/ and tests. I thought this layer didn't belong to any specific client, this is why I extracted it.

Greatly inspired by “Tom White's consistent hashing explaination”:weblogs.java.net/blog/tomwhite/archive/2007/11/consistent_hash.html.

You can’t perform that action at this time.