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

MQE: add support for or #9589

Merged
merged 10 commits into from
Oct 15, 2024
Merged

MQE: add support for or #9589

merged 10 commits into from
Oct 15, 2024

Conversation

charleskorn
Copy link
Contributor

@charleskorn charleskorn commented Oct 11, 2024

What this PR does

This PR adds support for the or binary operation to MQE.

In comparison to Prometheus' engine, MQE runs up to 70% faster and with up to 40% lower peak memory utilisation in our benchmarks:

goos: darwin
goarch: arm64
pkg: github.com/grafana/mimir/pkg/streamingpromql/benchmarks
cpu: Apple M1 Pro
                                                                      │  Prometheus  │               Mimir                │
                                                                      │    sec/op    │   sec/op     vs base               │
Query/a_1_or_b_1{l=~'.*[0-4]$'},_instant_query-10                        724.9µ ± 1%   728.9µ ± 2%        ~ (p=0.937 n=6)
Query/a_1_or_b_1{l=~'.*[0-4]$'},_range_query_with_100_steps-10           750.8µ ± 1%   727.2µ ± 1%   -3.15% (p=0.002 n=6)
Query/a_1_or_b_1{l=~'.*[0-4]$'},_range_query_with_1000_steps-10          1.328m ± 3%   1.188m ± 1%  -10.54% (p=0.002 n=6)
Query/a_100_or_b_100{l=~'.*[0-4]$'},_instant_query-10                    1.633m ± 1%   1.622m ± 2%        ~ (p=0.093 n=6)
Query/a_100_or_b_100{l=~'.*[0-4]$'},_range_query_with_100_steps-10       3.600m ± 1%   2.334m ± 1%  -35.16% (p=0.002 n=6)
Query/a_100_or_b_100{l=~'.*[0-4]$'},_range_query_with_1000_steps-10     20.976m ± 1%   8.572m ± 0%  -59.13% (p=0.002 n=6)
Query/a_2000_or_b_2000{l=~'.*[0-4]$'},_instant_query-10                  17.38m ± 1%   17.01m ± 7%        ~ (p=0.065 n=6)
Query/a_2000_or_b_2000{l=~'.*[0-4]$'},_range_query_with_100_steps-10     61.91m ± 2%   30.69m ± 2%  -50.43% (p=0.002 n=6)
Query/a_2000_or_b_2000{l=~'.*[0-4]$'},_range_query_with_1000_steps-10    487.5m ± 1%   145.3m ± 1%  -70.19% (p=0.002 n=6)
geomean                                                                  7.116m        4.874m       -31.51%

                                                                      │  Prometheus  │                Mimir                │
                                                                      │      B       │      B        vs base               │
Query/a_1_or_b_1{l=~'.*[0-4]$'},_instant_query-10                       69.93Mi ± 1%   69.32Mi ± 3%        ~ (p=0.394 n=6)
Query/a_1_or_b_1{l=~'.*[0-4]$'},_range_query_with_100_steps-10          69.87Mi ± 0%   69.73Mi ± 1%        ~ (p=0.240 n=6)
Query/a_1_or_b_1{l=~'.*[0-4]$'},_range_query_with_1000_steps-10         67.76Mi ± 2%   68.26Mi ± 3%        ~ (p=0.818 n=6)
Query/a_100_or_b_100{l=~'.*[0-4]$'},_instant_query-10                   65.95Mi ± 1%   66.36Mi ± 1%        ~ (p=0.132 n=6)
Query/a_100_or_b_100{l=~'.*[0-4]$'},_range_query_with_100_steps-10      67.23Mi ± 0%   66.59Mi ± 1%   -0.95% (p=0.009 n=6)
Query/a_100_or_b_100{l=~'.*[0-4]$'},_range_query_with_1000_steps-10     73.69Mi ± 1%   69.51Mi ± 1%   -5.67% (p=0.002 n=6)
Query/a_2000_or_b_2000{l=~'.*[0-4]$'},_instant_query-10                 68.48Mi ± 1%   69.93Mi ± 1%   +2.12% (p=0.009 n=6)
Query/a_2000_or_b_2000{l=~'.*[0-4]$'},_range_query_with_100_steps-10    87.44Mi ± 1%   78.52Mi ± 1%  -10.19% (p=0.002 n=6)
Query/a_2000_or_b_2000{l=~'.*[0-4]$'},_range_query_with_1000_steps-10   227.8Mi ± 4%   134.0Mi ± 3%  -41.16% (p=0.002 n=6)
geomean                                                                 80.85Mi        74.94Mi        -7.30%

Which issue(s) this PR fixes or relates to

(none)

Checklist

  • Tests updated.
  • [n/a] Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • [n/a] about-versioning.md updated with experimental features.

@charleskorn charleskorn force-pushed the charleskorn/mqe-or branch 2 times, most recently from 7639200 to 2f0737e Compare October 11, 2024 06:02
Copy link
Contributor

@jhesketh jhesketh left a comment

Choose a reason for hiding this comment

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

Approach looks good to me :-). Nothing in particular I'd change, other than the extra tests you're working on.

pkg/streamingpromql/operators/or_binary_operation.go Outdated Show resolved Hide resolved
pkg/streamingpromql/engine_test.go Show resolved Hide resolved
@charleskorn charleskorn marked this pull request as ready for review October 15, 2024 04:33
@charleskorn charleskorn requested a review from a team as a code owner October 15, 2024 04:33
Copy link
Contributor

@jhesketh jhesketh left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@charleskorn charleskorn merged commit 5690517 into main Oct 15, 2024
29 checks passed
@charleskorn charleskorn deleted the charleskorn/mqe-or branch October 15, 2024 08:50
@jhesketh jhesketh mentioned this pull request Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants