Skip to content

arriqaaq/xring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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