-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Efficient iteration and search in HashForLabels and HashWithoutLabels #5707
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
Conversation
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Can you include the query (anonymised) and some information about why this was taking so long? Ie how many series this was executing over, how many labels those series had etc. |
|
What do our benchmarks show for this? |
|
Query information: For each point:
Will post it soon. |
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
|
|
Also, should I try something similar for |
Weird! I'm surprised thats possible. Is it reproducible? Maybe your laptop was doing something else..
I think that sounds reasonable. |
|
There's a fair bit of noise in those benchmark results. |
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
|
Given how long this benchmark runs, there would indeed be some noise. I did some similar change to |
|
A thought: rather than using binary search, how about doing this as a merge? |
|
That would require |
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
| // TODO(fabxc): ensure names are sorted and then use that and sortedness | ||
| // of labels by names to speed up the operations below. | ||
| // Alternatively, inline the hashing and don't build new label sets. | ||
| sort.Strings(names) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took me nearly an hour to debug to this missing sort!
|
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
|
LGTM from me on this now. Thanks @codesome! |
|
👍 |
…prometheus#5707) * Efficient iteration and search in Labels.HashForLabels Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in> * Better names for variables Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in> * HashWithoutLabels optimizations Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in> * Refactor HashForLabels and HashWithoutLabels to take sorted names Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in> * Fix review comments Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
This brought down the time taken by
HashForLabelsfrom23+sfor a single query to<2s.In this PR: