Skip to content
A Consistent Hashing C++ add-on for node.js
C++ C JavaScript
Find file
Latest commit a6977cc Feb 1, 2012 @bnoguchi Update package.json

node-hash-ring - Consistent Hashing C++ Add-on for node.js

See this blog post for more information.


Via npm:

npm install hash_ring

Via git:

git clone
cd node-hash-ring/src
node-waf configure build


var HashRing = require("./lib/hash_ring");

// Create a cluster of 3 servers weighted so that stores twice as many 
// keys as, and stores 4x as many keys as
// and 2x as many keys as
var ring = new HashRing({"": 1, "": 2, "":4});
console.log(ring.getNode("users:102") ); // Should be

See ./test/test_distribution.js for another example: node test/test_distribution.js


To run the tests:

$ make test


MIT License


Brian Noguchi

Something went wrong with that request. Please try again.