Skip to content
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

receive: remove sort on label hashing #5224

Merged
merged 2 commits into from
Mar 9, 2022

Conversation

pablo-ruth
Copy link
Contributor

@pablo-ruth pablo-ruth commented Mar 9, 2022

  • I added CHANGELOG entry for this change.

Changes

I removed the sort on labels before hashinf them when using an hashring. The Prometheus remote write specification stand that:

MUST have label names sorted in lexicographical order

So I'm wondering if it's necessary to keep the sort on the receive side tor Thanos infrastructure with two "router only" receivers. I've done a pprof and I see that the sort code is using around 8% of CPU time, so it could be a significant optimization if we can skip it:

Screenshot from 2022-03-09 15-10-49

Verification

We are using the patched version for some time on our receivers and confirmed a reduction in resource consumption. We didn't see any side-effect.

Signed-off-by: Pablo RUTH <contact@pablo-ruth.fr>
@pablo-ruth pablo-ruth force-pushed the removeHashringLabelSort branch from fa26613 to a8a0542 Compare March 9, 2022 14:21
squat
squat previously approved these changes Mar 9, 2022
Copy link
Member

@squat squat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes a lot of sense to me. For large requests this can really be a heavy step

@pablo-ruth
Copy link
Contributor Author

Great! I added the CHANGELOG entry :)

Signed-off-by: Pablo RUTH <contact@pablo-ruth.fr>
@pablo-ruth pablo-ruth force-pushed the removeHashringLabelSort branch from 9854313 to ee29f40 Compare March 9, 2022 16:41
@squat squat merged commit 3026e58 into thanos-io:main Mar 9, 2022
@pablo-ruth pablo-ruth deleted the removeHashringLabelSort branch March 10, 2022 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants