-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Time framed thread-pool utilization #131898
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
Open
mhl-b
wants to merge
11
commits into
elastic:main
Choose a base branch
from
mhl-b:framed-thread-pool-utilization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+444
−176
Conversation
This file contains hidden or 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
23fe464
to
8345da4
Compare
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
Hi @mhl-b, I've created a changelog YAML for you. |
…sticsearch into framed-thread-pool-utilization
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
:Distributed Coordination/Allocation
All issues relating to the decision making around placing a shard (both master logic & on the nodes)
>enhancement
Team:Distributed Coordination
Meta label for Distributed Coordination team
v9.2.0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR changes Thread Pool utilization reporting intervals from dynamic (based on caller's frequency) into static (time frame based).
Originally there was a single consumer of utilization metric that runs on specific interval, so we would calculate utilization on the fly comparing previous invocation time and current. And it worked, kind of... With growing demand on utilization metrics, from shards balancing and allocation, we have new consumers, so this poll mechanism does not scale well. Thread pool needs to create a separate tracker for each caller.
This PR introduces total execution time measurements for thread-pool per time frame. Default frame duration is 30 seconds, but can configured per thread-pool via
TaskTrackingConfig
. All past time frames have accurate data, because we only update current frame. That means utilization metric can be stale up to duration of the time-frame in worst case. It's a tradeoff between liveliness and accuracy/efficiency. Utilization is not a "real-time" metric and there are no immediate actions on a single utilization metric.A new FramedTimeTracker incapsulates frame tracking logic, comes with own set of tests. Also added JMH benchmark, advised by Nick, due to use of synchronized methods and risk of high contention. So far I cannot see slowness from the bench, but would like to hear feedback on it. Those numbers are funny looking, but consistent through multiple runs, tracking thread-pool somehow faster with larger number of threads.
Latest result from my machine