<div dir="ltr"><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I believe one of the selector implementations buckets the connections to IO threads based on the port the socket is open on. This means with bad luck you could have 4 connections waiting on a single IO thread while other IO threads are idle especially if the connections are keepalive. I would try boosting the concurrency level quite a bit and see if you notice more IO threads being used.</span><br class="gmail-Apple-interchange-newline"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 24, 2018 at 8:56 PM, R. Matt Barnett <span dir="ltr">&lt;<a href="mailto:barnett@rice.edu" target="_blank">barnett@rice.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">My test is a little bogus anyway because I realized on the drive home  <br>
I did an invalid test/set on max seen.  But I think the conclusion  <br>
still stands because we only see 4 printfs.<br>
<br>
I&#39;m not very experienced with nio, but the way I assumed Undertow  <br>
worked, at a high level, was as follows:<br>
<br>
1.) Each incoming socket connection generated a channel.<br>
2.) Each channel created by step 1.) was associated with a singleton selector.<br>
3.) All IO threads polled the singleton selector waiting for requests  <br>
to process.<br>
<br>
Sort of a multi-producer/multi-consumer with a singleton queue model.<br>
<br>
Is this not the case? Is it the case that only one thread can poll  <br>
from a selector?<br>
<span class="HOEnZb"><font color="#888888"><br>
-- Matt<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
Quoting Stuart Douglas &lt;<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>&gt;:<br>
<br>
&gt; There is no guarantee that connections will be evenly distributed between<br>
&gt; IO threads. Once a client has connected the connection is tied to that IO<br>
&gt; thread, so it may be that you are just ending up with 2 connections on 4<br>
&gt; threads.<br>
&gt;<br>
&gt; Stuart<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Wed, Jul 25, 2018 at 10:02 AM R. Matt Barnett &lt;<a href="mailto:barnett@rice.edu">barnett@rice.edu</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; Hello,<br>
&gt;&gt;<br>
&gt;&gt; I&#39;m experiencing an Undertow performance issue I fail to understand.  I<br>
&gt;&gt; am able to reproduce the issue with the code linked bellow. The problem<br>
&gt;&gt; is that on Red Hat (and not Windows) I&#39;m unable to concurrently process<br>
&gt;&gt; more than 4 overlapping requests even with 8 configured IO Threads.<br>
&gt;&gt; For example, if I run the following program (1 file, 55 lines):<br>
&gt;&gt;<br>
&gt;&gt; <a href="https://gist.github.com/rmbarnett-rice/668db6b4e9f8f8da7093a3659b6ae2b5" rel="noreferrer" target="_blank">https://gist.github.com/<wbr>rmbarnett-rice/<wbr>668db6b4e9f8f8da7093a3659b6ae2<wbr>b5</a><br>
&gt;&gt;<br>
&gt;&gt; ... on Red Hat and then send requests to the server using Apache<br>
&gt;&gt; Benchmark...<br>
&gt;&gt;<br>
&gt;&gt;      &gt; ab -n 1000 -c 8 localhost:8080/<br>
&gt;&gt;<br>
&gt;&gt; I see the following output from the Undertow process:<br>
&gt;&gt;<br>
&gt;&gt;      Server started on port 8080<br>
&gt;&gt;<br>
&gt;&gt;      1<br>
&gt;&gt;      2<br>
&gt;&gt;      3<br>
&gt;&gt;      4<br>
&gt;&gt;<br>
&gt;&gt; I believe this demonstrates that only 4 requests are ever processed in<br>
&gt;&gt; parallel.  I would expect 8.  In fact, when I run the same experiment on<br>
&gt;&gt; Windows I see the expected output of<br>
&gt;&gt;<br>
&gt;&gt;      Server started on port 8080<br>
&gt;&gt;      1<br>
&gt;&gt;      2<br>
&gt;&gt;      3<br>
&gt;&gt;      4<br>
&gt;&gt;      5<br>
&gt;&gt;      6<br>
&gt;&gt;      7<br>
&gt;&gt;      8<br>
&gt;&gt;<br>
&gt;&gt; Any thoughts as to what might explain this behavior?<br>
&gt;&gt;<br>
&gt;&gt; Best,<br>
&gt;&gt;<br>
&gt;&gt; Matt<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">undertow-dev@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/undertow-dev</a><br>
<br>
<br>
<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/undertow-dev</a><br>
</div></div></blockquote></div><br></div>