<div dir="ltr">Is this valid for Wildfly? (I am using 8.2.1) <div><br></div><div>From the previous replies, I understood that the <span style="font-size:12.8px">ServletExtension could be used for embedded Undertow not for Wildfly. Anyway, I gave it a try, but still having Wildfly using </span><span style="font-size:12.8px">task-max-threads and io-threads parameters </span><span style="font-size:12.8px">from (subsystem=io/worker=default/).</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">To test this solution, I created a simple wepapp with one simple Servlet and my </span><span style="font-size:12.8px">ServletExtension.</span><span style="font-size:12.8px">handleDeployment</span><span style="font-size:12.8px"> </span><span style="font-size:12.8px">is executed by the Wildfly.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thanks</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 17, 2015 at 3:01 PM, Stuart Douglas <span dir="ltr"><<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Like I said, you can use any thread pool you want if you modify it using a ServletExtension.<br>
<br>
Code looks like:<br>
<br>
<br>
public class MyExtension implements ServletExtension {<br>
<br>
@Override<br>
public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) {<br>
Executor myThreadPool = {my thread pool};<br>
deploymentInfo.setExecutor(myThreadPool);<br>
}<br>
}<br>
<br>
Then add a META-INF/services entry for the extension.<br>
<span class="im HOEnZb"><br>
Stuart<br>
<br>
----- Original Message -----<br>
> From: "Mohammed ElGhaouat" <<a href="mailto:melghaouat@gmail.com">melghaouat@gmail.com</a>><br>
</span><span class="im HOEnZb">> To: "Stuart Douglas" <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>><br>
> Cc: "Jason Greene" <<a href="mailto:jason.greene@redhat.com">jason.greene@redhat.com</a>>, <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
</span><div class="HOEnZb"><div class="h5">> Sent: Wednesday, 14 October, 2015 12:22:20 PM<br>
> Subject: Re: [undertow-dev] Resizing undertow thread pool size dynamically<br>
><br>
> Hello,<br>
><br>
> I would like to share with you some more details about our situation. We<br>
> are using some big machines that are shared by many software(many Wildfly<br>
> instances, Databases, ERPs ..) If i don't set pools sizes i end up with big<br>
> pools as the default size is dependent on the number of CPU cores and out<br>
> system administrator is complaining about the OS spending time checking if<br>
> the threads have something to do and this impact the other softwares<br>
> installed on the same machine. If I set a small pool size which could<br>
> sufficient in the 90% of time, i am afraid that Wildfly couldn't handle<br>
> the 10% of time when the applications are used by a large number of user.<br>
><br>
> Is there any workaround or are you planning to let the user to set a<br>
> specific ThreadPoolExecutor ? so we can evict idle threads<br>
><br>
><br>
> Thanks,<br>
><br>
> Mohammed.<br>
><br>
><br>
> On Wed, Aug 12, 2015 at 11:03 AM, Mohammed ElGhaouat <<a href="mailto:melghaouat@gmail.com">melghaouat@gmail.com</a>><br>
> wrote:<br>
><br>
> > I am using Wildfly.<br>
> ><br>
> > Thanks,<br>
> ><br>
> > Mohammed.<br>
> ><br>
> > On Wed, Aug 12, 2015 at 10:55 AM, Stuart Douglas <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>><br>
> > wrote:<br>
> ><br>
> >> Are you using Wildfly or embedded Undertow?<br>
> >><br>
> >> If it is the later you can just use<br>
> >> io.undertow.servlet.api.DeploymentInfo#setExecutor to use whatever<br>
> >> executor<br>
> >> implementation you want.<br>
> >><br>
> >> The reason why most executors don't reduce the number is because there is<br>
> >> generally very little point, a parked thread is generally very cheap,<br>
> >> while<br>
> >> creating new threads is relatively expensive.<br>
> >><br>
> >> Stuart<br>
> >><br>
> >> ----- Original Message -----<br>
> >> > From: "Mohammed ElGhaouat" <<a href="mailto:melghaouat@gmail.com">melghaouat@gmail.com</a>><br>
> >> > To: "Jason Greene" <<a href="mailto:jason.greene@redhat.com">jason.greene@redhat.com</a>><br>
> >> > Cc: <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> >> > Sent: Wednesday, 12 August, 2015 6:19:11 PM<br>
> >> > Subject: Re: [undertow-dev] Resizing undertow thread pool size<br>
> >> dynamically<br>
> >> ><br>
> >> > We are using the servlet API and I am referring to worker pool. Simply<br>
> >> we<br>
> >> > don't want keeping bunch of idle threads in the JVM consuming some<br>
> >> resources<br>
> >> > without doing any thing useful.<br>
> >> ><br>
> >> > So with the bounded queue executor, when the value of the<br>
> >> task-max-threads<br>
> >> > parameter is reached, the number of threads in the worker pool couldn't<br>
> >> be<br>
> >> > decreased ?<br>
> >> ><br>
> >> > Thank you.<br>
> >> ><br>
> >> ><br>
> >> > Mohammed.<br>
> >> ><br>
> >> > On Tue, Aug 11, 2015 at 9:50 PM, Jason Greene < <a href="mailto:jason.greene@redhat.com">jason.greene@redhat.com</a><br>
> >> ><br>
> >> > wrote:<br>
> >> ><br>
> >> ><br>
> >> ><br>
> >> > > On Aug 11, 2015, at 4:42 AM, Mohammed ElGhaouat <<br>
> >> <a href="mailto:melghaouat@gmail.com">melghaouat@gmail.com</a> ><br>
> >> > > wrote:<br>
> >> > ><br>
> >> > ><br>
> >> > > Hi,<br>
> >> > ><br>
> >> > > I would like to know if there is a way to make undertow reducing the<br>
> >> size<br>
> >> > > of the thread pool when the server is less loaded. Is there any<br>
> >> > > parameter(or other way) that make an idle thread die after some<br>
> >> inactivity<br>
> >> > > time ?<br>
> >> ><br>
> >> ><br>
> >> > Are you referring to the worker pool or the I/O pool? The I/O pool is<br>
> >> special<br>
> >> > and is fixed. The worker pool currently uses a JDK ThreadPoolExecutor<br>
> >> with<br>
> >> > an unbounded queue which is a behavior pattern typically desired for web<br>
> >> > servers. That’s not pluggable at the moment, but it could be possible.<br>
> >> ><br>
> >> > If you are using the HttpHandler APIs, there is a method on<br>
> >> > HttpServerDispatch that allows you to use your own custom executor for<br>
> >> > blocking tasks (which would allow you to tune the default worker task<br>
> >> pool<br>
> >> > very small). If you are using servlet APIs though that uses the standard<br>
> >> > pools we provide.<br>
> >> ><br>
> >> > Is there a particular reason you want to kill idle threads? Threads are<br>
> >> cheap<br>
> >> > unless you are storing massive amounts of thread local data.<br>
> >> ><br>
> >> > --<br>
> >> > Jason T. Greene<br>
> >> > WildFly Lead / JBoss EAP Platform Architect<br>
> >> > JBoss, a division of Red Hat<br>
> >> ><br>
> >> ><br>
> >> ><br>
> >> > _______________________________________________<br>
> >> > undertow-dev mailing list<br>
> >> > <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> >> > <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br>
> >><br>
> ><br>
> ><br>
><br>
</div></div></blockquote></div><br></div>