[undertow-dev] Resizing undertow thread pool size dynamically

Jason Greene jason.greene at redhat.com
Tue Aug 11 15:50:33 EDT 2015


> On Aug 11, 2015, at 4:42 AM, Mohammed ElGhaouat <melghaouat at gmail.com> wrote:
> 
> 
> Hi,
> 
> I would like to know if there is a way to make undertow reducing the size of the thread pool when the server is less loaded. Is there any parameter(or other way) that make an idle thread die after some inactivity time ?


Are you referring to the worker pool or the I/O pool? The I/O pool is special and is fixed. The worker pool currently uses a JDK ThreadPoolExecutor with an unbounded queue which is a behavior pattern typically desired for web servers. That’s not pluggable at the moment, but it could be possible.

If you are using the HttpHandler APIs, there is a method on HttpServerDispatch that allows you to use your own custom executor for blocking tasks (which would allow you to tune the default worker task pool very small). If you are using servlet APIs though that uses the standard pools we provide.

Is there a particular reason you want to kill idle threads? Threads are cheap unless you are storing massive amounts of thread local data.

--
Jason T. Greene
WildFly Lead / JBoss EAP Platform Architect
JBoss, a division of Red Hat




More information about the undertow-dev mailing list