Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uphashmod uses fnv #981
Comments
This comment has been minimized.
This comment has been minimized.
|
What sort of skew are you seeing, and what sort of cardinality does the label you're hashing have? |
This comment has been minimized.
This comment has been minimized.
|
eyeballing some graphs: the skew is 100%. The load of prometheus1 is twice the load of prometheus0. The string we hash is (ultimately) defined by the user and frequently starts with the some prefix, we could do some transformations here, but "just" using a crypto hash function would solve this. |
This comment has been minimized.
This comment has been minimized.
|
That sounds like a misconfiguration rather than a skew issue. Can you share your configuration? It's recommended to hash on something like |
This comment has been minimized.
This comment has been minimized.
|
No, we can't split this on |
This comment has been minimized.
This comment has been minimized.
|
The sharding functions are intended for use when a single job has gotten so big that it won't fit on a single prometheus server. Up to that point we recommend splitting off Prometheus servers based on functionality/team/level of stack. Given this you're best off running separate Prometheus servers and managing the split yourself, which also avoids all the complexity of a master/slave setup. |
This comment has been minimized.
This comment has been minimized.
|
But why being so hesitant of changing the hash function? Is that because of performance reasons? I don't think how we structured our setup is particularly strange and it would work perfectly (out-of-the-box) is hashmod was just doing a crypto hash. |
This comment has been minimized.
This comment has been minimized.
|
I've no problem changing the hash function if there's significant skew. There's no performance concerns here as it's only calculated when a target is created or updated. How many jobs do you have? It doesn't sound like this is a good way to do your setup though. It's a very advanced feature meant for a specific use case, It's not meant to split things out on something as coarse as |
This comment has been minimized.
This comment has been minimized.
|
It already does not fit on one prometheus instance :) That's why we are using a federated setup and use hashmod to shared on the job level. Thanks for considering this request! |
This comment has been minimized.
This comment has been minimized.
The problem comes when a single job doesn't fit. All your jobs not fitting is much easier to deal with.. Can you give examples of the job names that all got put on the same shard, and how many shards you're using? |
This comment has been minimized.
This comment has been minimized.
|
Totally agree, this shouldn't be using FNV. That hash is notorious for only changing the output a little if the input changes only a little. If you have two places that change only a little in the input, you can often even get the same output again, which is what might be biting you here (still would be interesting to get some colliding examples though to confirm). Let's switch this to a better hash. I'm on vacation for the rest of the week, but |
This comment has been minimized.
This comment has been minimized.
|
On Wed, Aug 12, 2015, 2:22 PM Julius Volz notifications@github.com wrote:
|
This comment has been minimized.
This comment has been minimized.
|
#982 is merged now. It's not clear this allows for another use case, as job sizes are generally going to be too variable to shard based on. |
brian-brazil
closed this
Aug 13, 2015
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 24, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
miekg commentedAug 12, 2015
Hi,
We see a huge discrepancy in the load hitting our scraping prometheus-ussss. We use hashmod to spread the load. hashmod used fnv which is a "non-cryptographic hash function". I think it makes sense to just use a crypto hash for hashmod, like md5 or sha1 which should result in a more even load distribution.