-
Notifications
You must be signed in to change notification settings - Fork 569
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
frontend: More versatile configuration for subquery spin-off #10696
Conversation
4c61c6a
to
f5c92e5
Compare
💻 Deploy preview available: https://deploy-preview-mimir-10696-zb444pucvq-vp.a.run.app/docs/mimir/latest/ |
f5c92e5
to
6c162c8
Compare
2af004d
to
d99aee2
Compare
Expands on #10460 Testing has shown nice results for the feature. In our main Mimir cell, the overall runtime of all instant queries containing the "subquery pattern" (`[<range>:(<step>)?]`) has gone down by half, and the feature allows for queries further into the past by sharding by time Currently, this is only configurable with `-query-frontend.spin-off-instant-subqueries-to-url` + a required per-tenant `instant_queries_with_subquery_spin_off`` opt-in (list of regexp) This PR makes the configs more consistent and allows for a global enable. Here are the new configs: - `-query-frontend.instant-subquery-spin-off.enable-by-default`. False by default, set to true to enable for all tenants. This is overriden with `instant_subquery_spin_off_enabled_regexp` on tenants - `-query-frontend.instant-subquery-spin-off.min-range-duration`. Defaults to 12h. This is overriden with `instant_subquery_spin_off_min_range_duration` on tenants - `-query-frontend.instant-subquery-spin-off.url`. The frontend config part of the feature. Required
d99aee2
to
2790bf8
Compare
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.
the changes look ok, but it's not super clear if you intend to keep these configs long-term or they are for some validaiton testing now. Maybe you can include this in the PR description.
I don't think they are of great use from an operator's perspective and I'm assuming you're adding them so you can progressively roll this out.
}, | ||
{ | ||
"kind": "field", | ||
"name": "instant_subquery_spin_off_url", |
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.
i haven't been involved so far, but IIRC this extra flag is just for the current testing, right? not planned to be kept long-term?
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.
It's needed. The feature is about spinning off subqueries as actual range queries. We do that by sending an entirely new request to a given URL. Mimir doesn't really know the URL of the frontend service, as Mimir can run in various set-ups
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.
oh i didn't know we go over the HTTP boundary again. Can't we just send it to localhost
? What is this pointed to otherwise?
pkg/util/validation/limits.go
Outdated
MaxFutureQueryWindow model.Duration `yaml:"max_future_query_window" json:"max_future_query_window" category:"experimental"` | ||
|
||
// Subquery Spin-off | ||
InstantSubquerySpinOffEnabledRegexp []string `yaml:"instant_subquery_spin_off_enabled_regexp" json:"instant_subquery_spin_off_enabled_regexp" doc:"nocli|description=List of regular expression patterns matching instant queries. Subqueries within those instant queries will be spun off as range queries to optimize their performance." category:"experimental"` |
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.
would you need this as a global setting as well?
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.
The fact that it's a slice doesn't lend itself well to a CLI arg. I think the current model of being able to enable/disable per-tenant + this extra per-tenant override that isn't available as a flag is enough configurability
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.
Yes, these new flags will allow me to roll this out at large. The feature is still being tested. When things are settled, I will create a configure page, like this one for example: https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/configure-blocked-queries.md |
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.
Looks good! One minor question!
@@ -46,7 +46,7 @@ | |||
* [ENHANCEMENT] Distributor, querier, ingester and store-gateway: Add support for `limit` parameter for label names and values requests. #10410 | |||
* [ENHANCEMENT] Query-frontend: Allow adjustment of queries looking into the future to a maximum duration with experimental `-query-frontend.max-future-query-window` flag. #10547 | |||
* [ENHANCEMENT] Ruler: Adds support for filtering results from rule status endpoint by `file[]`, `rule_group[]` and `rule_name[]`. #10589 | |||
* [ENHANCEMENT] Query-frontend: Add option to "spin off" subqueries as actual range queries, so that they benefit from query acceleration techniques such as sharding, splitting and caching. To enable this, set the `-query-frontend.spin-off-instant-subqueries-to-url=<url>` option on the frontend and the `instant_queries_with_subquery_spin_off` per-tenant override with regular expressions matching the queries to enable. #10460 #10603 #10621 | |||
* [ENHANCEMENT] Query-frontend: Add option to "spin off" subqueries as actual range queries, so that they benefit from query acceleration techniques such as sharding, splitting and caching. To enable this, set the `-query-frontend.instant-subquery-spin-off.url=<url>` option on the frontend and the `instant_subquery_spin_off_enabled_regexp` per-tenant override with regular expressions matching the queries to enable. #10460 #10603 #10621 #10696 |
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.
* [ENHANCEMENT] Query-frontend: Add option to "spin off" subqueries as actual range queries, so that they benefit from query acceleration techniques such as sharding, splitting and caching. To enable this, set the `-query-frontend.instant-subquery-spin-off.url=<url>` option on the frontend and the `instant_subquery_spin_off_enabled_regexp` per-tenant override with regular expressions matching the queries to enable. #10460 #10603 #10621 #10696 | |
* [ENHANCEMENT] Query-frontend: Add option to "spin off" subqueries as actual range queries, so that they benefit from query acceleration techniques such as sharding, splitting, and caching. To enable this feature, set the `-query-frontend.instant-subquery-spin-off.url=<url>` option on the frontend and the `instant_subquery_spin_off_enabled_regexp` per-tenant override with regular expressions matching the queries you want to enable. #10460 #10603 #10621 #10696 |
@@ -215,7 +215,7 @@ The following features are currently experimental: | |||
- Server-side write timeout for responses to active series requests (`-query-frontend.active-series-write-timeout`) | |||
- Caching of non-transient error responses (`-query-frontend.cache-errors`, `-query-frontend.results-cache-ttl-for-errors`) | |||
- Blocking HTTP requests on a per-tenant basis (configured with the `blocked_requests` limit) | |||
- Spinning off (as actual range queries) subqueries from instant queries (`-query-frontend.spin-off-instant-subqueries-to-url` and the `instant_queries_with_subquery_spin_off` per-tenant limit) | |||
- Spinning off (as actual range queries) subqueries from instant queries (`-query-frontend.instant-subquery-spin-off.url` and the `instant_subquery_spin_off_enabled_regexp` per-tenant limit) |
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.
- Spinning off (as actual range queries) subqueries from instant queries (`-query-frontend.instant-subquery-spin-off.url` and the `instant_subquery_spin_off_enabled_regexp` per-tenant limit) | |
- Spinning off subqueries from instant queries as actual range queries (`-query-frontend.instant-subquery-spin-off.url` and the `instant_subquery_spin_off_enabled_regexp` per-tenant limit) |
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.
I tried to eliminate the double parenthesis for clarity. Let me know if this works!
I was more concerned about all the slices and min-durations and especially the URL. Would be nice if this feature just works and doesn't need any fiddling with flags |
I will test out using localhost in our cells. I've given it more thought and I think what you're saying makes sense. We could get away with only the regexp (one flag/user limit) |
Superseded by #10703. Thanks for the review @dimitarvdimitrov. Let's go with the simpler config |
Expands on #10460
Testing has shown nice results for the feature. In our main Mimir cell, the overall runtime of all instant queries containing the "subquery pattern" (
[<range>:(<step>)?]
) has gone down by half, and the feature allows for queries further into the past by sharding by timeCurrently, this is only configurable with
-query-frontend.spin-off-instant-subqueries-to-url
+ a required per-tenantinstant_queries_with_subquery_spin_off
opt-in (list of regexp)This PR makes the configs more consistent and allows for a global enable. Here are the new configs:
-query-frontend.instant-subquery-spin-off.enabled
. False by default, set to true to enable for all tenants. This is overridden withinstant_subquery_spin_off_enabled
on tenants. There is an extra list of regexp that can be given per-tenant as well:instant_subquery_spin_off_enabled_regexp
. This can be useful to roll out the feature one query at a time-query-frontend.instant-subquery-spin-off.min-range-duration
. Defaults to 12h. This is overridden withinstant_subquery_spin_off_min_range_duration
on tenants-query-frontend.instant-subquery-spin-off.url
. The frontend config part of the feature. RequiredChecklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.