ketama
Ketama consistent hash ring compatible with libmemcached/twemproxy.
A zero-dependency implementation of the ketama consistent hashing algorithm. Adding or removing a server remaps only ~1/N of keys instead of all keys.
Features
- MD5-based virtual nodes (160 per server at weight 1)
- Weighted node support
- Compatible with libmemcached/twemproxy ketama algorithm
- Zero external dependencies
Usage
[]
= "0.0.1"
use Ring;
// Build a ring with 3 servers
let ring = build;
// Route a key to a server index
let shard = ring.route;
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.