feat: complex 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 737d413)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 737d413 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit ba6046c
Suggestions up to commit 1053561
Suggestions up to commit aaaa8e4
Suggestions up to commit aaaa8e4
Suggestions up to commit 009300a
|
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 |
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
e04d775 to
559a2d0
Compare
|
Persistent review updated to latest commit 559a2d0 |
1 similar comment
|
Persistent review updated to latest commit 559a2d0 |
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
|
Persistent review updated to latest commit 73c68cf |
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
|
Persistent review updated to latest commit 21dd714 |
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
|
Persistent review updated to latest commit 9ba8eef |
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
|
Persistent review updated to latest commit 009300a |
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
7580ddb to
aaaa8e4
Compare
|
Persistent review updated to latest commit 7580ddb |
|
Persistent review updated to latest commit aaaa8e4 |
|
Persistent review updated to latest commit 1053561 |
|
Persistent review updated to latest commit ba6046c |
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
|
Persistent review updated to latest commit 737d413 |
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.