-
Notifications
You must be signed in to change notification settings - Fork 179
Conversation
Avoid a tree of merge objects, which can result in what I suspect is n^2 calls to Seek when using Without. With 100k metrics, and a regex of ^$ in BenchmarkHeadPostingForMatchers: Before: BenchmarkHeadPostingForMatchers-8 1 51633185216 ns/op 29745528 B/op 200357 allocs/op After: BenchmarkHeadPostingForMatchers-8 10 108924996 ns/op 25715025 B/op 101748 allocs/op Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
The promql bench results.
|
@brian-brazil btw how did you run |
I changed the matcher to |
yep , I replicated it. Any idea for the promql bench results? |
Those are all for small queries, how do the bigger ones look? |
the full result
|
It looks like if there's less than ~100 iterators, then the current implementation can be faster. However the cost here is something like 0.2ms, against saving many seconds in larger cases. |
and it is much easier to understand. LGTM |
Avoid a tree of merge objects, which can result in what I suspect is n^2 calls to Seek when using Without. With 100k metrics, and a regex of ^$ in BenchmarkHeadPostingForMatchers: Before: BenchmarkHeadPostingForMatchers-8 1 51633185216 ns/op 29745528 B/op 200357 allocs/op After: BenchmarkHeadPostingForMatchers-8 10 108924996 ns/op 25715025 B/op 101748 allocs/op Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
FYI that suprisingly killed our ability to use this helper in Thanos (thanos-io/thanos#753). The interface allows for it, so maybe it's fair, but just a lesson to me to subscribe for TSDB changes ;p |
@bwplotka could we have added something in the changelog to help for such cases in the future? |
What exactly? I think it's general rule to think seriously about other users of TSDB than just Prometheus. (: |
Avoid a tree of merge objects, which can result in
what I suspect is n^2 calls to Seek when using Without.
With 100k metrics, and a regex of ^$ in BenchmarkHeadPostingForMatchers:
Before:
BenchmarkHeadPostingForMatchers-8 1 51633185216 ns/op 29745528 B/op 200357 allocs/op
After:
BenchmarkHeadPostingForMatchers-8 10 108924996 ns/op 25715025 B/op 101748 allocs/op
Signed-off-by: Brian Brazil brian.brazil@robustperception.io