<div dir="ltr">I am using Wildfly.<div><br></div><div>Thanks,</div><div><br></div><div>Mohammed.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 12, 2015 at 10:55 AM, Stuart Douglas <span dir="ltr">&lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Are you using Wildfly or embedded Undertow?<br>
<br>
If it is the later you can just use io.undertow.servlet.api.DeploymentInfo#setExecutor to use whatever executor implementation you want.<br>
<br>
The reason why most executors don&#39;t reduce the number is because there is generally very little point, a parked thread is generally very cheap, while creating new threads is relatively expensive.<br>
<br>
Stuart<br>
<div><div class="h5"><br>
----- Original Message -----<br>
&gt; From: &quot;Mohammed ElGhaouat&quot; &lt;<a href="mailto:melghaouat@gmail.com">melghaouat@gmail.com</a>&gt;<br>
&gt; To: &quot;Jason Greene&quot; &lt;<a href="mailto:jason.greene@redhat.com">jason.greene@redhat.com</a>&gt;<br>
&gt; Cc: <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
&gt; Sent: Wednesday, 12 August, 2015 6:19:11 PM<br>
&gt; Subject: Re: [undertow-dev] Resizing undertow thread pool size dynamically<br>
&gt;<br>
&gt; We are using the servlet API and I am referring to worker pool. Simply we<br>
&gt; don&#39;t want keeping bunch of idle threads in the JVM consuming some resources<br>
&gt; without doing any thing useful.<br>
&gt;<br>
&gt; So with the bounded queue executor, when the value of the task-max-threads<br>
&gt; parameter is reached, the number of threads in the worker pool couldn&#39;t be<br>
&gt; decreased ?<br>
&gt;<br>
&gt; Thank you.<br>
&gt;<br>
&gt;<br>
&gt; Mohammed.<br>
&gt;<br>
&gt; On Tue, Aug 11, 2015 at 9:50 PM, Jason Greene &lt; <a href="mailto:jason.greene@redhat.com">jason.greene@redhat.com</a> &gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; &gt; On Aug 11, 2015, at 4:42 AM, Mohammed ElGhaouat &lt; <a href="mailto:melghaouat@gmail.com">melghaouat@gmail.com</a> &gt;<br>
&gt; &gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Hi,<br>
&gt; &gt;<br>
&gt; &gt; I would like to know if there is a way to make undertow reducing the size<br>
&gt; &gt; of the thread pool when the server is less loaded. Is there any<br>
&gt; &gt; parameter(or other way) that make an idle thread die after some inactivity<br>
&gt; &gt; time ?<br>
&gt;<br>
&gt;<br>
&gt; Are you referring to the worker pool or the I/O pool? The I/O pool is special<br>
&gt; and is fixed. The worker pool currently uses a JDK ThreadPoolExecutor with<br>
&gt; an unbounded queue which is a behavior pattern typically desired for web<br>
&gt; servers. That’s not pluggable at the moment, but it could be possible.<br>
&gt;<br>
&gt; If you are using the HttpHandler APIs, there is a method on<br>
&gt; HttpServerDispatch that allows you to use your own custom executor for<br>
&gt; blocking tasks (which would allow you to tune the default worker task pool<br>
&gt; very small). If you are using servlet APIs though that uses the standard<br>
&gt; pools we provide.<br>
&gt;<br>
&gt; Is there a particular reason you want to kill idle threads? Threads are cheap<br>
&gt; unless you are storing massive amounts of thread local data.<br>
&gt;<br>
&gt; --<br>
&gt; Jason T. Greene<br>
&gt; WildFly Lead / JBoss EAP Platform Architect<br>
&gt; JBoss, a division of Red Hat<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; undertow-dev mailing list<br>
&gt; <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br>
</blockquote></div><br></div>