<div dir="ltr">Awesome, thx.  I&#39;m not using Undertow in Wildfly, but rather another product called Runwar that we bundle in the CommandBox CLI for running Java wars- primarily CFML engines.  I&#39;m actually thinking about bugging a couple of the APM vendors for CF apps to see if they&#39;ll tap into this in their serve monitors for apps running on Undertow/CommandBox.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div></div><div>Thanks!</div><div><br></div><div>~Brad</div><div><br></div><div><b>Developer Advocate</b></div><div><i>Ortus Solutions, Corp </i></div><div><b><br></b></div><div>E-mail: <a href="mailto:brad@coldbox.org" target="_blank">brad@coldbox.org</a></div><div>ColdBox Platform: <a href="http://www.coldbox.org" target="_blank">http://www.coldbox.org</a> </div><div>Blog: <a href="http://www.codersrevolution.com" target="_blank">http://www.codersrevolution.com</a></div><div><br></div></div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Feb 22, 2018 at 2:17 PM, Masafumi Miura <span dir="ltr">&lt;<a href="mailto:masafumi0920@gmail.com" target="_blank">masafumi0920@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You can use jconsole to check org.xnio MBean. (By the way, if you use WildFly 11, you can also check the same metrics under io subsystem through JBoss CLI.)<br><br>If you use Undertow with XNIO 3.4.3 or later, you can also obtain XnioWorkerMXBean from XnioWorker through Undertow API. For example:<br><br> - From io.undertow.server.<wbr>HttpServerExchange: exchange.getConnection().<wbr>getWorker().getMXBean()<br> - From io.undertow.Undertow: undertow.getWorker().<wbr>getMXBean()<br><br>Then, you can access the following metrics from the MXBean:<br><br> - getBusyWorkerThreadCount() = current busy worker thread count<br> - getWorkerQueueSize() = current queue size of worker thread pool<br> - getCoreWorkerPoolSize() = core worker thread pool size which you configured<br> - getMaxWorkerPoolSize() = max worker thread pool size which you configured<br> - getIoThreadCount() = io thread pool size which you configured<br><br>Though the latest undertow pom.xml specifies XNIO 3.3.8.Final as a dependency, I believe it&#39;s compatible and it works with newer versions of XNIO. (Actually, WildFly 11 comes with Undertow 1.4.18.Final and XNIO 3.5.4.Final.)<br><br>Thanks,<br>Masafumi<div><div class="h5"><br><br>On Fri, Feb 23, 2018 at 1:03 AM, Brad Wood &lt;<a href="mailto:bdw429s@gmail.com" target="_blank">bdw429s@gmail.com</a>&gt; wrote:<br>&gt; Perfect.  Thanks everyone!  One final question-- how do I get the MBean to<br>&gt; monitor the queued requests?  A tutorial link would be fine.<br>&gt;<br>&gt; Thanks!<br>&gt;<br>&gt; ~Brad<br>&gt;<br>&gt; Developer Advocate<br>&gt; Ortus Solutions, Corp<br>&gt;<br>&gt; E-mail: <a href="mailto:brad@coldbox.org" target="_blank">brad@coldbox.org</a><br>&gt; ColdBox Platform: <a href="http://www.coldbox.org" target="_blank">http://www.coldbox.org</a><br>&gt; Blog: <a href="http://www.codersrevolution.com" target="_blank">http://www.codersrevolution.<wbr>com</a><br>&gt;<br>&gt;<br>&gt; On Thu, Feb 22, 2018 at 9:54 AM, Jason Greene &lt;<a href="mailto:jason.greene@redhat.com" target="_blank">jason.greene@redhat.com</a>&gt;<br>&gt; wrote:<br>&gt;&gt;<br>&gt;&gt; Thats the TCP backlog queue, which is only for connections that are being<br>&gt;&gt; initially established. Once the connection is accepted (which happens pretty<br>&gt;&gt; quickly since undertows I/o handling is non-blocking) then the queue entry<br>&gt;&gt; is removed. Worker size does not affect undertows ability to handle incoming<br>&gt;&gt; connections.<br>&gt;&gt;<br>&gt;&gt; The reason applications set limit is just a safeguard against some types<br>&gt;&gt; of flood/dos.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; On Feb 22, 2018, at 9:38 AM, Brad Wood &lt;<a href="mailto:bdw429s@gmail.com" target="_blank">bdw429s@gmail.com</a>&gt; wrote:<br>&gt;&gt;<br>&gt;&gt; Thanks guys.  I seem to have gotten a couple conflicting replies :)<br>&gt;&gt;<br>&gt;&gt; &gt;  it defaults to a queue size of 1000<br>&gt;&gt;<br>&gt;&gt; &gt;  It is unbounded<br>&gt;&gt;<br>&gt;&gt; What exactly is the 1000 backlog setting doing?<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; Thanks!<br>&gt;&gt;<br>&gt;&gt; ~Brad<br>&gt;&gt;<br>&gt;&gt; Developer Advocate<br>&gt;&gt; Ortus Solutions, Corp<br>&gt;&gt;<br>&gt;&gt; E-mail: <a href="mailto:brad@coldbox.org" target="_blank">brad@coldbox.org</a><br>&gt;&gt; ColdBox Platform: <a href="http://www.coldbox.org" target="_blank">http://www.coldbox.org</a><br>&gt;&gt; Blog: <a href="http://www.codersrevolution.com" target="_blank">http://www.codersrevolution.<wbr>com</a><br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; On Thu, Feb 22, 2018 at 4:32 AM, Stuart Douglas &lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;<br>&gt;&gt; wrote:<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; On Thu, Feb 22, 2018 at 4:04 PM, Brad Wood &lt;<a href="mailto:bdw429s@gmail.com" target="_blank">bdw429s@gmail.com</a>&gt; wrote:<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; I&#39;m looking for a bit of understanding on just how Undertow handles<br>&gt;&gt;&gt;&gt; large numbers of requests coming into a server.  Specifically when more<br>&gt;&gt;&gt;&gt; requests are being sent in than are being completed.  I&#39;ve been doing some<br>&gt;&gt;&gt;&gt; load testing on a CFML app (Lucee Server) where I happen to have my<br>&gt;&gt;&gt;&gt; io-threads set to 4 and my worker-threads set to 150.  I&#39;m using a<br>&gt;&gt;&gt;&gt; monitoring tool (FusionReactor) that shows me the number of currently<br>&gt;&gt;&gt;&gt; executing threads at my app and under heavy load I see exact 150 running<br>&gt;&gt;&gt;&gt; HTTP threads in my app server, which makes sense since I have 150 worker<br>&gt;&gt;&gt;&gt; threads.  I&#39;m assuming here that I can&#39;t simultaneously process more<br>&gt;&gt;&gt;&gt; requests than I have worker threads (please correct if I&#39;m off there)  <br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; So assuming I&#39;m thinking that through correctly, what happens to<br>&gt;&gt;&gt;&gt; additional requests that are coming into the server at that point?  I assume<br>&gt;&gt;&gt;&gt; they are being queued somewhere, but<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; What is this queue?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; The queue is in the XNIO worker (although if you want you could just use<br>&gt;&gt;&gt; a different executor which has its own queue).<br>&gt;&gt;&gt;  <br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; How do I monitor it?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; XNIO binds an MBean that you can use to inspect the worker queue size.<br>&gt;&gt;&gt;  <br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; How big can it get?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; It is unbounded, as rejecting tasks from the worker is very problematic<br>&gt;&gt;&gt; in some circumstances. If you want to limit the number of concurrent<br>&gt;&gt;&gt; requests use the io.undertow.server.handlers.<wbr>RequestLimitingHandler<br>&gt;&gt;&gt;  <br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; Where do I change the size?<br>&gt;&gt;&gt;&gt; How long do things stay in there before sending back an error to the<br>&gt;&gt;&gt;&gt; HTTP client?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; If you use the RequestLimitingHandler this is configurable. It has its<br>&gt;&gt;&gt; own queue with a fixed size, and a configurable timeout.<br>&gt;&gt;&gt;  <br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; Can I control what error comes back to the HTTP client in that scenario?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; You can using io.undertow.server.handlers.<wbr>RequestLimit#setFailureHandler<br>&gt;&gt;&gt;  <br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; If I&#39;m using an HTTP/S and AJP listener, do they all share the same<br>&gt;&gt;&gt;&gt; settings?  Do they share the same queues?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; In general yes. You could give each listener its own limiting handler<br>&gt;&gt;&gt; with its own queue if you wanted by explicitly setting the listeners root<br>&gt;&gt;&gt; handler, however in general they will all just use the same handler chain.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Stuart<br>&gt;&gt;&gt;  <br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; I&#39;ve done a bit of Googling and reviewed some docs but haven&#39;t quite<br>&gt;&gt;&gt;&gt; found any definitive information on this, and a lot of info I found was<br>&gt;&gt;&gt;&gt; about Wildfly specifically so I wasn&#39;t sure how much of it applied.  <br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; Thanks!<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; ~Brad<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; Developer Advocate<br>&gt;&gt;&gt;&gt; Ortus Solutions, Corp<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; E-mail: <a href="mailto:brad@coldbox.org" target="_blank">brad@coldbox.org</a><br>&gt;&gt;&gt;&gt; ColdBox Platform: <a href="http://www.coldbox.org" target="_blank">http://www.coldbox.org</a><br>&gt;&gt;&gt;&gt; Blog: <a href="http://www.codersrevolution.com" target="_blank">http://www.codersrevolution.<wbr>com</a><br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; ______________________________<wbr>_________________<br>&gt;&gt;&gt;&gt; undertow-dev mailing list<br>&gt;&gt;&gt;&gt; <a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/undertow-dev</a><br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; ______________________________<wbr>_________________<br>&gt;&gt; undertow-dev mailing list<br>&gt;&gt; <a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/undertow-dev</a><br>&gt;<br>&gt;<br>&gt;<br>&gt; ______________________________<wbr>_________________<br>&gt; undertow-dev mailing list<br>&gt; <a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>&gt; <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/undertow-dev</a></div></div></div>
</blockquote></div><br></div>