Fix hash order to generate more even distribution (#5247)
The problem in existing code was the following line ``` start := int(keyCrc%uint32(cardinality)) | 1 ``` A given a value of N cardinality the ending result because of the the bitwise '|' would lead to always higher affinity to odd sequences. As can be seen from the test cases that this can lead to many objects being allocated the same set of disks or atleast the first disk is an odd disk always. This introduces a performance problem for majority of the objects under concurrent load. Remove `| 1` to provide a more cleaner distribution and the new code will be. ``` start := int(keyCrc % uint32(cardinality)) ``` Thanks to Krishna Srinivas for pointing out the bitwise situation here.master
parent
6d7319380c
commit
d45a8784fc
Loading…
Reference in new issue