<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"><<a href="mailto:barnett@rice.edu" target="_blank">barnett@rice.edu</a>></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'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 <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>>:<br>
<br>
> There is no guarantee that connections will be evenly distributed between<br>
> IO threads. Once a client has connected the connection is tied to that IO<br>
> thread, so it may be that you are just ending up with 2 connections on 4<br>
> threads.<br>
><br>
> Stuart<br>
><br>
><br>
><br>
><br>
> On Wed, Jul 25, 2018 at 10:02 AM R. Matt Barnett <<a href="mailto:barnett@rice.edu">barnett@rice.edu</a>> wrote:<br>
><br>
>> Hello,<br>
>><br>
>> I'm experiencing an Undertow performance issue I fail to understand. I<br>
>> am able to reproduce the issue with the code linked bellow. The problem<br>
>> is that on Red Hat (and not Windows) I'm unable to concurrently process<br>
>> more than 4 overlapping requests even with 8 configured IO Threads.<br>
>> For example, if I run the following program (1 file, 55 lines):<br>
>><br>
>> <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>
>><br>
>> ... on Red Hat and then send requests to the server using Apache<br>
>> Benchmark...<br>
>><br>
>> > ab -n 1000 -c 8 localhost:8080/<br>
>><br>
>> I see the following output from the Undertow process:<br>
>><br>
>> Server started on port 8080<br>
>><br>
>> 1<br>
>> 2<br>
>> 3<br>
>> 4<br>
>><br>
>> I believe this demonstrates that only 4 requests are ever processed in<br>
>> parallel. I would expect 8. In fact, when I run the same experiment on<br>
>> Windows I see the expected output of<br>
>><br>
>> Server started on port 8080<br>
>> 1<br>
>> 2<br>
>> 3<br>
>> 4<br>
>> 5<br>
>> 6<br>
>> 7<br>
>> 8<br>
>><br>
>> Any thoughts as to what might explain this behavior?<br>
>><br>
>> Best,<br>
>><br>
>> Matt<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>
<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>