Skip to content
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

Merged
merged 2 commits into from Feb 24, 2021

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Feb 22, 2021

Introduced to QueuedThreadPool:

  • getMaxReservedThreads()
  • getAvailableReservedThreads()
  • getAvailableThreads()
  • getReadyThreads()
  • getLeasedThreads()

Also few small code cleanups.

Signed-off-by: Simone Bordet simone.bordet@gmail.com

Introduced to QueuedThreadPool:

* getMaxReservedThreads()
* getAvailableReservedThreads()
* getAvailableThreads()
* getReadyThreads()
* getLeasedThreads()

Also few small code cleanups.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet requested a review from gregw February 22, 2021 22:02
Copy link
Contributor

@gregw gregw left a 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 

Updates after review.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet requested a review from gregw February 23, 2021 17:13
@joakime
Copy link
Contributor

joakime commented Feb 23, 2021

I'm keen to +1 this PR just because it's javadoc'd! :-)

Copy link
Contributor

@gregw gregw left a 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.

@sbordet sbordet merged commit c9cd1e4 into jetty-9.4.x Feb 24, 2021
@sbordet sbordet deleted the jetty-9.4.x-5994-qtp_free_threads branch February 24, 2021 08:31
@sbordet sbordet added this to In progress in Jetty 9.4.38 via automation Feb 24, 2021
@sbordet sbordet linked an issue Feb 24, 2021 that may be closed by this pull request
@sbordet sbordet moved this from In progress to Done in Jetty 9.4.38 Feb 24, 2021
This was referenced Mar 10, 2021
This was referenced Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

QueuedThreadPool "free" threads
3 participants