-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fixes #5994 - QueuedThreadPool "free" threads #5995
Conversation
Introduced to QueuedThreadPool: * getMaxReservedThreads() * getAvailableReservedThreads() * getAvailableThreads() * getReadyThreads() * getLeasedThreads() Also few small code cleanups. Signed-off-by: Simone Bordet <[email protected]>
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.
Updated from my comment on the issue...
We need a good vocab to describe all the states a thread can be in and then matching getters and JMX fields:
- inactive: not started but there is capacity to start another thread
- idle: started and waiting in the pool for a task
- reserved: taken from the pool but reserved to do a task
- leased: taken from the pool to do a (budgeted - maxReserved) task like selecting
- utilised: taken from the pool for a non-leased task.
So we have some invariants and derived stats:
max = inactive + idle + reserved + leased + utilised
threads = idle + reserved + leased + utilised
busy = leased + utilised
ready = idle + reserved
utilised = threads - idle - reserved - leased
available = max - busy
maxAvailable = max - leased
utilisation = utilised / maxAvailable # 0.0 means idle, 1.0 means at capacity
jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java
Outdated
Show resolved
Hide resolved
jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java
Show resolved
Hide resolved
Updates after review. Signed-off-by: Simone Bordet <[email protected]>
I'm keen to +1 this PR just because it's javadoc'd! :-) |
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.
I think there is more we can say in the javadoc.... but for another PR.
Introduced to QueuedThreadPool:
Also few small code cleanups.
Signed-off-by: Simone Bordet [email protected]