title: Wildfly - Can't get Max Connections greater than 256
body: <p>I am load testing an application deployed on Wildfly 20 using JMeter. The observation is that under load of <code>300 requests/sec</code> and more <strong>Wildfly server doesn't respond to few requests and those requests time out</strong>. On analyzing server logs (both system and application) and thread dumps nothing related to this is found and memory utilization is also normal.</p>
  <p>On tuning some parameters such as <code>Open File Descriptors</code>, Wildfly <code>IO threads/Task Max Threads</code>, <code>Max Connections</code> and Apache configuration <em>[details below]</em> the number of requests getting timed out have significantly reduced but still a lot of requests time out.</p>
  <p>Using Wildfly Runtime for monitoring during load testing one thing drew my attention that even on setting the Undertow's <code>Http Max Connections</code> parameter to a value lets say 1000 the <code>Connection Count</code> value (circled in screenshot below) never exceeds 256. On playing with this parameter a bit I saw that <code>Http Max Connections</code> parameter sets to any value less than 256 but never more. And it looks like once this limit is reached no new request is served as gets timed out until some connections are freed.</p>
  <p>Is there is some other configuration (Apache or OS) which puts this limit or any other Wildfly configuration responsible for this? Am I missing anything?
  <em><strong>[Used Wildfly Management Console for all configurations]</strong></em></p>
  <p><em>[from standalone.xml]</em></p>
  <pre><code>&lt;subsystem xmlns=&quot;urn:jboss:domain:io:3.0&quot;&gt;    
      &lt;worker name=&quot;default&quot; io-threads=&quot;300&quot; task-max-threads=&quot;300&quot;/&gt;    
      &lt;buffer-pool name=&quot;default&quot;/&gt;    
  &lt;/subsystem&gt;
  </code></pre>
  <p>...</p>
  <pre><code>&lt;subsystem xmlns=&quot;urn:jboss:domain:undertow:11.0&quot; default-server=&quot;default-server&quot; default-virtual-host=&quot;default-host&quot; default-servlet-container=&quot;default&quot; default-security-domain=&quot;other&quot; statistics-enabled=&quot;true&quot;&gt;
              &lt;buffer-cache name=&quot;default&quot;/&gt;
              &lt;server name=&quot;default-server&quot;&gt;
                  &lt;http-listener name=&quot;default&quot; max-connections=&quot;500&quot; socket-binding=&quot;http&quot; max-cookies=&quot;100&quot; record-request-start-time=&quot;true&quot; redirect-socket=&quot;https&quot; enable-http2=&quot;true&quot;/&gt;
                  &lt;https-listener name=&quot;https&quot; socket-binding=&quot;https&quot; max-cookies=&quot;100&quot; record-request-start-time=&quot;true&quot; security-realm=&quot;ApplicationRealm&quot; enable-http2=&quot;true&quot;/&gt;
                  &lt;host name=&quot;default-host&quot;&gt;
                      &lt;location name=&quot;/&quot; handler=&quot;welcome-content&quot;/&gt;
                      &lt;filter-ref name=&quot;limit-connections&quot;/&gt;
                      &lt;http-invoker security-realm=&quot;ApplicationRealm&quot;/&gt;
                  &lt;/host&gt;
              &lt;/server&gt;
              &lt;servlet-container name=&quot;default&quot;&gt;
                  &lt;jsp-config/&gt;
                  &lt;websockets/&gt;
              &lt;/servlet-container&gt;
              &lt;handlers&gt;
                  &lt;file name=&quot;welcome-content&quot; path=&quot;${jboss.home.dir}/welcome-content&quot;/&gt;
              &lt;/handlers&gt;
              &lt;filters&gt;
                  &lt;request-limit name=&quot;limit-connections&quot; max-concurrent-requests=&quot;10000&quot; queue-size=&quot;10000&quot;/&gt;
              &lt;/filters&gt;
          &lt;/subsystem&gt;
  </code></pre>
  <p><em>[Apache configuration]</em></p>
  <pre><code>&lt;IfModule mpm_worker_module&gt;
      ServerLimit          40
      StartServers          2
      MaxClients          1000
      MinSpareThreads      25
      MaxSpareThreads      75
      ThreadsPerChild      25
      MaxRequestsPerChild   0
  &lt;/IfModule&gt;
  </code></pre>
  <p><em>[Wildfly Runtime monitoring console during testing]</em>
  <a href="https://i.stack.imgur.com/epUDm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/epUDm.png" alt="enter image description here" /></a></p>