Setting up maximum of connections for web
Asked Answered
D

4

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

Devorahdevore answered 23/4, 2015 at 14:5 Comment(0)
P
15

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

Pessimist answered 23/4, 2015 at 16:31 Comment(4)
What will be the max-concurrent-requests allowed by default if this filter is not added?Craquelure
it is 2,147,483,647 by default. Ref- docs.wildfly.org/19/wildscribe/subsystem/undertow/configuration/…Southeast
@CaffeineCoder Yep I know but question is for jboss7 (tomcat web container) not wilfly undertow.Pessimist
@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.Southeast
W
10

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

Waterway answered 12/10, 2017 at 12:44 Comment(0)
C
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

Chance answered 28/7, 2021 at 7:59 Comment(1)
Do you know the difference between the max-connections and defining a filter?Heron
H
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...

Heron answered 28/10, 2021 at 15:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.