-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow disabling PQ-based QP cache rewarm when reloading schemas
In #3829 we taught router to use the PQ list to prewarm the query planner cache when reloading its schema. In #5340 we gave it the experimental option to do the same thing at startup. Now we are allowing you to turn off the on-reload prewarm. Because the PQ list does not have metadata to tell the Router which PQs have been used recently, if you have a large PQ list then the on-reload prewarm can slow down schema updates noticeably, and it may not provide much value over prewarming based on the contents of the in-memory QP cache itself. We keep the same defaults, but let you turn off the on-reload prewarm with: ``` persisted_queries: experimental_prewarm_query_plan_cache: on_reload: false ``` Previously, `persisted_queries.experimental_prewarm_query_plan_cache` was a boolean; a migration moves this boolean to `persisted_queries.experimental_prewarm_query_plan_cache.on_startup`. (`on_startup` defaults to false and `on_reload` defaults to true.) This migration uses a `type: change` action. No such actions existed in the codebase and the implementation appeared to be buggy: there is no top-level `==` operator (or top-level operators at all) in JSONPath. This PR fixes the implementation of `type: change` to use the `[?(@.x == y)]` filter syntax which does appear to work (as tested by the migration tests for the new migration).
- Loading branch information
Showing
18 changed files
with
138 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
### Allow disabling persisted-queries-based query plan cache prewarm on schema reload | ||
|
||
In Router v1.31.0, we started including operations from persisted query lists when Router pre-warms the query plan cache when loading a new schema. | ||
|
||
In Router v1.49.0, we let you also pre-warm the query plan cache from the persisted query list during Router startup by setting `persisted_queries.experimental_prewarm_query_plan_cache` to true. | ||
|
||
We now allow you to disable the original feature, so that Router will only pre-warm recent operations from the query planning cache when loading a new schema (and not the persisted query list as well), by setting `persisted_queries.experimental_prewarm_query_plan_cache.on_reload` to `false`. | ||
|
||
The option added in v1.49.0 has been renamed from `persisted_queries.experimental_prewarm_query_plan_cache` to `persisted_queries.experimental_prewarm_query_plan_cache.on_startup`. Existing configuration files will keep working as before, but with a warning that can be resolved by updating your config file: | ||
|
||
```diff | ||
persisted_queries: | ||
enabled: true | ||
- experimental_prewarm_query_plan_cache: true | ||
+ experimental_prewarm_query_plan_cache: | ||
+ on_startup: true | ||
``` | ||
|
||
|
||
By [@glasser](https://github.com/glasser) in https://github.com/apollographql/router/pull/5990 |
12 changes: 12 additions & 0 deletions
12
apollo-router/src/configuration/migrations/0028-pq-prewarm-to-on_startup.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
description: Experimental persisted query prewarm query plan cache can now be configured separately for `on_startup` and `on_reload`; the previous value now means `on_startup` | ||
actions: | ||
- type: change | ||
path: persisted_queries.experimental_prewarm_query_plan_cache | ||
from: true | ||
to: | ||
on_startup: true | ||
- type: change | ||
path: persisted_queries.experimental_prewarm_query_plan_cache | ||
from: false | ||
to: | ||
on_startup: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...tion__tests__upgrade_old_configuration@persisted-queries-prewarm-already-object.yaml.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: apollo-router/src/configuration/tests.rs | ||
expression: new_config | ||
--- | ||
--- | ||
persisted_queries: | ||
enabled: true | ||
experimental_prewarm_query_plan_cache: | ||
on_reload: false |
9 changes: 9 additions & 0 deletions
9
...configuration__tests__upgrade_old_configuration@persisted-queries-prewarm-false.yaml.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: apollo-router/src/configuration/tests.rs | ||
expression: new_config | ||
--- | ||
--- | ||
persisted_queries: | ||
enabled: true | ||
experimental_prewarm_query_plan_cache: | ||
on_startup: false |
9 changes: 9 additions & 0 deletions
9
..._configuration__tests__upgrade_old_configuration@persisted-queries-prewarm-true.yaml.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
source: apollo-router/src/configuration/tests.rs | ||
expression: new_config | ||
--- | ||
--- | ||
persisted_queries: | ||
enabled: true | ||
experimental_prewarm_query_plan_cache: | ||
on_startup: true |
4 changes: 4 additions & 0 deletions
4
...outer/src/configuration/testdata/migrations/persisted-queries-prewarm-already-object.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
persisted_queries: | ||
enabled: true | ||
experimental_prewarm_query_plan_cache: | ||
on_reload: false |
3 changes: 3 additions & 0 deletions
3
apollo-router/src/configuration/testdata/migrations/persisted-queries-prewarm-false.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
persisted_queries: | ||
enabled: true | ||
experimental_prewarm_query_plan_cache: false |
3 changes: 3 additions & 0 deletions
3
apollo-router/src/configuration/testdata/migrations/persisted-queries-prewarm-true.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
persisted_queries: | ||
enabled: true | ||
experimental_prewarm_query_plan_cache: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters