-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Distribution is not uniform #10
Comments
I run into this situation also, i think the crc32 hash algorithm is not suitable to be used to distribute keys. |
I see something similar, two of 3 instances appear to be relatively even and as soon as you add a third it gets very uneven |
I come with the same problem. maybe the hash returns a uint32 key. the space is not big enough? I am not sure. |
+1 Same issue. |
+1 |
Increase the replicas (ie.: 100) |
This can just decrease the in-balance but can not resolve it completely. |
I don't think we can achieve perfect balance.. I am using another library, but using a replicas of 100 coupled with the fnv32a hash gives me pretty uniform results... |
I agree. fnv32a is a pretty good hash function for use in consistent hash for its uniform distribution. |
I added an option to use fnv32a: UseFnv.
There are some tests that show it has a more uniform distribution. |
still not uniformly distributed.... and it differs A LOT when different elements are added, which is very confusing...... // why the name of elements will influence the result so much??? I finally solved the problem with the solution from this: strava/go.serversets@cb6a0bf |
Since this repo is not maintained? |
Please see strava/go.serversets#7 for more details. That library uses a vendored version of this consistent hash library. What I'm seeing is a distribution like:
(count - server for 10k random strings)
This uneven distribution is what we're seeing in production so I don't think it's an issue with the random key generation. Have you guys encountered this before? Am I using the code wrong?
The text was updated successfully, but these errors were encountered: