https://github.com/arriqaaq/xring
An implementation of Consistent Hashing with Bounded Loads (using Red-Black tree)
https://github.com/arriqaaq/xring
bounded-load consistent-hashing consistent-hashing-library go golang redblacktree
Last synced: 3 months ago
JSON representation
An implementation of Consistent Hashing with Bounded Loads (using Red-Black tree)
- Host: GitHub
- URL: https://github.com/arriqaaq/xring
- Owner: arriqaaq
- License: mit
- Created: 2018-08-29T04:06:46.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-15T06:21:37.000Z (about 6 years ago)
- Last Synced: 2025-03-18T10:51:28.441Z (3 months ago)
- Topics: bounded-load, consistent-hashing, consistent-hashing-library, go, golang, redblacktree
- Language: Go
- Homepage: https://medium.com/techlog/consistent-hashing-with-bounded-loads-using-a-red-black-tree-b5aaf0d8540f
- Size: 10.7 KB
- Stars: 49
- Watchers: 3
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xring
A consistent hash ring with bounded loads
Consistent hashing with bounded loads implementation using Red Black Tree
## Example Usage
```go
nodes := []string{"a", "b", "c"}
cnf := &xring.Config{
VirtualNodes: 300,
LoadFactor: 2,
}
hashRing := xring.NewRing(nodes, cnf)
node,err:=hashRing.Get("foo")/*
Call this post execution of any function, else
the traffic would be load balanced, and get stuck if
all nodes are busy
*/
hashRing.Done(node)
```## TODO
- Add more test cases
- Performance test for xxhash## Paper
https://ai.googleblog.com/2017/04/consistent-hashing-with-bounded-loads.htmlhttps://www.akamai.com/es/es/multimedia/documents/technical-publication/consistent-hashing-and-random-trees-distributed-caching-protocols-for-relieving-hot-spots-on-the-world-wide-web-technical-publication.pdf
xring Image source: https://ai.googleblog.com/2017/04/consistent-hashing-with-bounded-loads.html