[openstack-dev] [Swift] (Non-)consistency of the Swift hash ring implementation

Nejc Saje nsaje at redhat.com
Sun Sep 7 18:20:04 UTC 2014


Hey guys,

in Ceilometer we're using consistent hash rings to do workload
partitioning[1]. We've considered using Ironic's hash ring 
implementation, but found out it wasn't actually consistent (ML[2], 
patch[3]). The next thing I noticed that the Ironic implementation is 
based on Swift's.

The gist of it is: since you divide your ring into a number of equal 
sized partitions, instead of hashing hosts onto the ring, when you add a 
new host, an unbound amount of keys get re-mapped to different hosts 
(instead of the 1/#nodes remapping guaranteed by hash ring).

Swift's hash ring implementation is quite complex though, so I took the 
conceptually similar code from Gregory Holt's blogpost[4] (which I'm 
guessing is based on Gregory's efforts on Swift's hash ring 
implementation) and tested that instead. With a simple test (paste[5]) 
of first having 1000 nodes and then adding 1, 99.91% of the data was moved.

I have no way to test this in Swift directly, so I'm just throwing this 
out there, so you guys can figure out whether there actually is a 
problem or not.

Cheers,
Nejc

[1] https://review.openstack.org/#/c/113549/
[2] 
http://lists.openstack.org/pipermail/openstack-dev/2014-September/044566.html
[3] https://review.openstack.org/#/c/118932/4
[4] http://greg.brim.net/page/building_a_consistent_hashing_ring.html
[5] http://paste.openstack.org/show/107782/




More information about the OpenStack-dev mailing list