feat: slow query thread pool#5628
Conversation
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
PR Reviewer Guide 🔍(Review updated until commit 434021f)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 434021f Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 6fdd82e
Suggestions up to commit 46c3cbe
Suggestions up to commit 5b0d7b2
|
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
|
Persistent review updated to latest commit 46c3cbe |
|
Persistent review updated to latest commit 6fdd82e |
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
|
Persistent review updated to latest commit 434021f |
Description
Following discussion on #5608, this PR implements a dedicated thread pool for slow queries. This helps keep the cluster responsive in cases of specific expensive queries being run, as the main worker thread pool will still be available to process fast queries. This comes with a
plugins.sql.slow_worker_pool.enabledsetting (default true).The pool exists as a separate resource that the worker can hand off to. So the normal fast query path is unchanged, we only hand off in known special cases. This also means we only pay rescheduling overhead for queries that are already slow.
I've tested this by saturating a cluster with >20sec queries (until all slow threads are active and requests are queued), and then verified that normal cheap queries are still responsive even if slow queries are at capacity.
Guide for reviewers:
ScriptDetector.java. We primary look for specific expensive UDFs (rex, parse), window functions, joins, or any script pushdown contexts.ThreadPoolExecutionDispatcher, if we hit theScriptDetectorcheck we do a handoff involving a lot of thread context propagation and cleanup. This is the riskiest part of the code, I've been carefully checking that the context propagation is working correctly and that we handle things like auth context (field level security) and cancellation.Related Issues
Resolves #5608
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.