【问题标题】:Wildfly - Can't get Max Connections greater than 256Wildfly - 无法获得大于 256 的最大连接数
【发布时间】:2021-03-01 10:35:57
【问题描述】:

我正在使用 JMeter 对部署在 Wildfly 20 上的应用程序进行负载测试。观察结果是在300 requests/sec 和更多负载下Wildfly 服务器不响应少数请求并且这些请求超时。在分析服务器日志(系统和应用程序)和线程转储时,没有发现与此相关的任何内容,内存利用率也正常。

在调整某些参数时,例如 Open File Descriptors、Wildfly IO threads/Task Max ThreadsMax Connections 和 Apache 配置[详情如下] 超时的请求数量已显着减少,但仍然有很多请求超时。

在负载测试期间使用 Wildfly 运行时进行监控有一件事情引起了我的注意,即使将 Undertow 的 Http Max Connections 参数设置为一个值,也可以说是 1000,Connection Count 值(在下面的屏幕截图中圈出)永远不会超过 256。这个参数有点我看到Http Max Connections 参数设置为小于256 的任何值,但永远不会超过。看起来一旦达到此限制,就不会提供新的请求,因为在某些连接被释放之前会超时。

是否有其他配置(Apache 或操作系统)设置此限制或任何其他 Wildfly 配置对此负责?我错过了什么吗? [使用 Wildfly 管理控制台进行所有配置]

[来自standalone.xml]

<subsystem xmlns="urn:jboss:domain:io:3.0">    
    <worker name="default" io-threads="300" task-max-threads="300"/>    
    <buffer-pool name="default"/>    
</subsystem>

...

<subsystem xmlns="urn:jboss:domain:undertow:11.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other" statistics-enabled="true">
            <buffer-cache name="default"/>
            <server name="default-server">
                <http-listener name="default" max-connections="500" socket-binding="http" max-cookies="100" record-request-start-time="true" redirect-socket="https" enable-http2="true"/>
                <https-listener name="https" socket-binding="https" max-cookies="100" record-request-start-time="true" security-realm="ApplicationRealm" enable-http2="true"/>
                <host name="default-host">
                    <location name="/" handler="welcome-content"/>
                    <filter-ref name="limit-connections"/>
                    <http-invoker security-realm="ApplicationRealm"/>
                </host>
            </server>
            <servlet-container name="default">
                <jsp-config/>
                <websockets/>
            </servlet-container>
            <handlers>
                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
            </handlers>
            <filters>
                <request-limit name="limit-connections" max-concurrent-requests="10000" queue-size="10000"/>
            </filters>
        </subsystem>

[Apache 配置]

<IfModule mpm_worker_module>
    ServerLimit          40
    StartServers          2
    MaxClients          1000
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>

[测试期间的 Wildfly Runtime 监控控制台]

【问题讨论】:

  • 找到原因了吗?

标签: java concurrency wildfly http-proxy


【解决方案1】:

也许您的服务器没有调整到满足最大进程数?将以下内容添加到您的 /etc/security/limits.conf 文件中:

jboss soft nproc 8000
jboss hard nproc 12000
jboss soft nofile 9999
jboss hard nofile 9999

【讨论】:

    猜你喜欢
    • 2021-12-07
    • 2016-02-22
    • 1970-01-01
    • 1970-01-01
    • 2018-02-14
    • 2020-01-02
    • 2013-04-20
    • 2017-03-25
    • 2018-06-30
    相关资源
    最近更新 更多