-
Notifications
You must be signed in to change notification settings - Fork 272
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
initial stab at making the router prewarm on pqs #5340
Conversation
CI performance tests
|
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.
If we were to mark this feature in particular as experimental for the initial drop, how would we do that? Would we do it with configuration? In other words, how do we make it so we DO NOT use pre-warming from the PQ manifest unless it's explicitly enabled?
We could just add a config option under the query planning chunk if that's preferable. I believe we've stated with others before that this is expected behavior, but if we'd like to keep it safe, we can certainly make it opt-in. |
Ok, understood. It was really more about making it safe and validating it with a few customers first, but if we can claim it's safe, I'm comfortable. |
I'd be ok with an option here too |
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
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).
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).
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).
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). This also renames a migration file added in #5957 that used a non-standard filename.
As #5334 outlined, the existing query plan warmup mechanism only warmed up the cache upon reload of either the schema or (if using dev mode/hot-reload) the config.
This PR allows the warmup function to occur on startup as well, enabling persisted queries to be used to warm up prior to serving traffic, helping reduce latency introduced by the query planner.
Fixes #5334
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
Exceptions
The existing setup had no tests, so unsure how/where tests should be written for this.