-
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
Improve insufficient thread warnings/errors #1851
Comments
Created a ThreadBudget class that can be used to warn/error for registered and unregistered allocations of threads. The server on doStart does an unregistered check of all its components that implement the Allocation interface. The client will register itself as an Allocation if a shared Executor is used.
Branch jetty-9.4.x-1851-ThreadBudget has an improved thread usage warning. Instead of a heuristic hard coded in the server, there is now a ThreadBudget.Allocation interface that components can implement to declare how many threads they will need. |
@sbordet review needed, specially on the client side. |
Refactor approach to use Leases, to handle multiple executors
@sbordet I had to take an entirely different approach. There are now leases on threads taken to express commitments. |
Squashed commit of the following: commit 1d9e8e4 Merge: 7280594 55b0f10 Author: Greg Wilkins <gregw@webtide.com> Date: Thu Sep 28 07:20:37 2017 +1000 Merge branch 'jetty-9.4.x' into jetty-9.4.x-1851-ThreadBudget commit 7280594 Author: Greg Wilkins <gregw@webtide.com> Date: Wed Sep 27 22:48:58 2017 +1000 fixed headers commit f962f18 Author: Greg Wilkins <gregw@webtide.com> Date: Wed Sep 27 18:12:33 2017 +1000 Issue #1851 added reset commit a63894d Author: Greg Wilkins <gregw@webtide.com> Date: Wed Sep 27 18:08:53 2017 +1000 Issue #1851 improved test commit 8bcc460 Author: Greg Wilkins <gregw@webtide.com> Date: Wed Sep 27 18:03:47 2017 +1000 Issue #1851 Improve insufficient thread warnings/errors Refactor approach to use Leases, to handle multiple executors commit fe4be5f Merge: abc5eac a248d38 Author: Greg Wilkins <gregw@webtide.com> Date: Wed Sep 27 15:37:56 2017 +1000 Merge branch 'jetty-9.4.x' into jetty-9.4.x-1851-ThreadBudget commit abc5eac Author: Greg Wilkins <gregw@webtide.com> Date: Wed Sep 27 12:20:03 2017 +1000 Issue #1851 Improve insufficient thread warnings/errors Created a ThreadBudget class that can be used to warn/error for registered and unregistered allocations of threads. The server on doStart does an unregistered check of all its components that implement the Allocation interface. The client will register itself as an Allocation if a shared Executor is used.
@gregw I think we must also call These threads will be blocked in Also, should Furthermore, I'd like to rename |
Good point on the selectors.... Note that minimal is 0 acceptors, as we can do async accepting. I don't think the Server should lease a thread, as we have the warnAt margin. If you have < warnAt (defaults to number of CPUs) then you get a warning, which becomes an error at 0. So if no threads available to handle requests, that is already a hard error |
ThreadBudget -> ThreadPoolBudget. Added selectors to the leased threads.
@gregw I added leasing on selectors and renamed |
Added ExecutorSizedThreadPool, a wrapper around JDK's ThreadPoolExecutor that implements SizedThreadPool (and therefore returns a ThreadPoolBudget). Deprecated ExecutorThreadPool, an older version of ExecutorSizedThreadPool.
If a server or client is configured with a threadpool containing insufficient threads, then an informative warning and/or error should occur
The text was updated successfully, but these errors were encountered: