13

In JBoss7 we've restricted number of web connections by using this

<connector name="https" scheme="https" protocol="HTTP/1.1" socket-binding="https" secure="true" max-connections="3000">

for urn:jboss:domain:web:1.0 subsystem which is replaced by urn:jboss:domain:undertow:1.2 in the wildfly. How to setup max-connections in wildfly?

I went through the documentation and didn't find matching attribute.

Thanks

Federico Sierra
  • 5,118
  • 2
  • 23
  • 36
Pat
  • 391
  • 2
  • 3
  • 13

4 Answers4

14

Try add under filters definition

<filters>
    <connection-limit name="limit-connections" max-concurrent-requests="3000" queue-size="100"/>
</filters>

and then under host or location add (depends on your need)

<filter-ref name="limit-connections"/>

See a configuration example and Model Reference

Also take a look in Configuring the Web server Pool: http://www.javacodegeeks.com/2014/01/entering-undertow-web-server.html

Federico Sierra
  • 5,118
  • 2
  • 23
  • 36
  • 2
    What will be the max-concurrent-requests allowed by default if this filter is not added? – Valsaraj Viswanathan Dec 06 '18 at 05:21
  • it is 2,147,483,647 by default. Ref- https://docs.wildfly.org/19/wildscribe/subsystem/undertow/configuration/filter/request-limit/index.html – Caffeine Coder Oct 19 '21 at 06:45
  • @CaffeineCoder Yep I know but question is for jboss7 (tomcat web container) not wilfly undertow. – Federico Sierra Oct 19 '21 at 13:42
  • @FedericoSierra I think he is asking for WIldfly in his question- ". How to setup max-connections in wildfly?". To answer your question for JBoss, this parameter is undefined which results in unlimited connections. – Caffeine Coder Oct 19 '21 at 15:05
9

The above comment from Federico Sierra is correct. But in Wildfly 10.x the filter name 'connection-limit' doesn't exist anymore. Instead it is now called 'request-limit'.

So for Wildfly 10.x add filter reference in the untertow subsystem inside 'server' and 'host' context and the request-limit filter inside the 'filters' context:

<subsystem xmlns="urn:jboss:domain:undertow:3.1">
[...]
  <server name="default-server">
  [...]
    <host name="default-host" alias="localhost">
    <location name="/" handler="welcome-content"/>
    [...]
      <filter-ref name="limit-connections"/>
    </host>
  </server>
[...]
  <filters>
    <response-header name="server-header" header-name="Server" header-value="WildFly/10"/>
    <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
    <request-limit name="limit-connections" max-concurrent-requests="3000" queue-size="100"/>
  </filters>
</subsystem>

Reference: https://github.com/wildfly/wildfly/blob/master/undertow/src/test/resources/org/wildfly/extension/undertow/undertow-3.1.xml

Claudio Kuenzler
  • 772
  • 7
  • 12
1

If you want to limit the maximum number of concurrent connections for an HTTP/HTTPS/AJP Connector you have to set the attribute max-connections. Example:

/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=max-connections,value=300)

Source: How to set the maximum number of Web connections in WildFly

Francesco Marchioni
  • 4,091
  • 1
  • 25
  • 40
0

I would use the max-conncections attribute as defined in the documentation. Either for http and/or https connections. It is defined as

"The maximum number of concurrent connections. Only values greater than 0 are allowed. For unlimited connections simply undefine this attribute value."

I don't see the benefit of defining an extra filter. But maybe the others can shed some light on this... So similar to the other solutions it would look like this:

<subsystem xmlns="urn:jboss:domain:undertow:10.0">
[...]
  <server name="default-server">
    <http-listener name="default" socket-binding="http" max-connections="3000" redirect-socket="https" enable-http2="true"/>
    <https-listener name="https" socket-binding="https" max-connections="3000" security-realm="ApplicationRealm" enable-http2="true" />
  [...]       
  </server>
[...]
</subsystem>

Update: I just realized that this is the standalone.xml solution to what Francesco is proposing...

Lonzak
  • 9,334
  • 5
  • 57
  • 88