-
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
Is it possible to define max number of virtual threads when VirtualThreadsExecutor is enabled, i.e. max number of http requests being handled in the same time? #12154
Comments
There is no relationship of connections (or requests) to thread count. Look into using As a different solution, consider QoSHandler |
There is a |
@ascho we are planning to add a limit to
|
@joakime thank you! I will try to use QoSHandler it seems that it solves the problem of defining the upper bound of handled requests in the moment of time. As i understand there is an unlimited priority queue to store requests which exceeded max request count and QoSHandler reschedules these suspended requests after MaxSuspend duration only 1 time and next reschedule gives 503? I am a little bit confused with this logic meaning suspended request is not removed from CyclicTimeouts iterable stuff. @sbordet thanks 🙏 ! Waiting for it :) |
Updated VirtualThreadPool to limit the number of concurrent virtual threads using a Semaphore. Updated modules and documentation. Signed-off-by: Simone Bordet <[email protected]>
@sbordet thank you 🙏 with all respect to your effort it is too risky for me to use change with concurrency primitives in the prod for now 😭 |
@joakime as you adviced i used QoSHandler and noticed interesting issue. It seems that: WHEN Jetty is configured to use Virtual Threads i am observing that retrying of the wave of suspended http requests grow ThreadPool to defined maximum of threads. Is my assumption correct? UPD: {:xs "VirtualThread[5715]/runnable@ForkJoinPool-1-worker-7"} thanks 🙏 |
@ascho if the request attribute However, I can see how also resumed requests may end up in a non-virtual thread. |
Updated VirtualThreadPool to limit the number of concurrent virtual threads using a Semaphore. Updated modules and documentation. Signed-off-by: Simone Bordet <[email protected]>
12.0.12
Java 21
Question
Hi!
Is it possible to define max number of virtual threads when VirtualThreadsExecutor is enabled, i.e. max number of http requests being handled in the same time?
I tried to dig into source code and as a result assumed that any request submitted to Jetty is dispatched to virtual thread executor via AdaptiveExecutionStrategy as is so it doesn't mater 1k or 1kk requests came.
Thanks!
The text was updated successfully, but these errors were encountered: