An open API service indexing awesome lists of open source software.

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)

Awesome Lists containing this project

README

        

# xring
A consistent hash ring with bounded loads
Consistent hashing with bounded loads implementation using Red Black Tree
![xring](https://3.bp.blogspot.com/-pgZ4b9H7VlM/WOJ91rDe_XI/AAAAAAAABqw/wIjtyPHheFgyHpXIqY4qNLhd_H9DnHsXACLcB/s640/image00.png)

## 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.html

https://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