Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 1.05 KB

README.md

File metadata and controls

37 lines (27 loc) · 1.05 KB

xring

A consistent hash ring with bounded loads Consistent hashing with bounded loads implementation using Red Black Tree xring

Example Usage

	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