【问题标题】:Apache Tomcat-9.0.16 Setting property 'maxConcurrentStreamExecution' to '100' did not find a matching propertyApache Tomcat-9.0.16 将属性“maxConcurrentStreamExecution”设置为“100”未找到匹配的属性
【发布时间】:2019-07-21 07:01:19
【问题描述】:

我有一个支持 http2 的 tomcat 配置,按照 9.0.16 documentation,如果没有指定,将使用默认值 20。

所以,我只想将 maxConcurrentStreamExecution 和 maxConcurrentStream 增加到 100 或 200,所以我按照上面提到的文档进行配置

我的连接器配置如下,

<Connector port="9191" 
    URIEncoding="UTF-8"
    sslImplementationName="org.apache.tomcat.util.net.openssl.OpenSSLImplementation"
    protocol="org.apache.coyote.http11.Http11Nio2Protocol"
    maxThreads="50000" SSLEnabled="true" compressibleMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json,application/xml" 
    compression="on" minSpareThreads="25" 
    noCompressionUserAgents="gozilla, traviata" scheme="https" secure="true" keystoreFile="conf/keystoreFile.keystore" keystorePass="password">
    <UpgradeProtocol compression="on" maxConcurrentStreamExecution="100" maxConcurrentStreams="100" className="org.apache.coyote.http2.Http2Protocol">
    </UpgradeProtocol>
</Connector>

但是,当检查 tomcat 日志时,我可以看到一个警告

注意:选择 JDK_JAVA_OPTIONS:--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java .rmi/sun.rmi.transport=ALL-UNNAMED

27-Feb-2019 19:16:34.595 警告 [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} 将属性“maxConcurrentStreamExecution”设置为“100”没有找到匹配的属性。

2019 年 2 月 27 日 19:16:34.603 警告 [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} 将属性“maxConcurrentStreams”设置为“100”没有找到匹配的属性。

27-Feb-2019 19:16:34.679 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log 服务器版本名称:Apache Tomcat/9.0.16

2019 年 2 月 27 日 19:16:34.679 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log 服务器建成时间:2019 年 2 月 4 日 16:30:29 UTC

27-Feb-2019 19:16:34.680 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log 服务器版本号:9.0.16.0

27-Feb-2019 19:16:34.680 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log 操作系统名称:Linux

27-Feb-2019 19:16:34.680 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log 操作系统版本:4.4.0-141-generic

27-Feb-2019 19:16:34.681 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log 架构:amd64

如您所见,tomcat 正在抛出找不到匹配的属性警告,

但是这个配置对我来说是必要的,以增加我的服务器的吞吐量,该服务器将处理大量 http2 多路复用的 post 请求

Tomcat:9.0.16, JDK:OpneJDK_10.0.1, 操作系统:Ubunut/Centos

请让我知道我错在哪里以及如何正确配置以正确使用属性

TIA

【问题讨论】:

  • 似乎您将属性添加到连接器而不是 upgradeProtocol 元素。您确定在您的问题中截断的 server.xml 是服务器加载的吗?它适用于我的代码。 (使用 jdk 11)
  • 如果我故意添加错字,我会收到消息:WARNING: Match [Server/Service/Connector/UpgradeProtocol] failed to set property [maxConcurrentStreamExecutionTest] to [100]
  • 是的,我想我已经在连接器和upgradeHandler中添加了,将删除并验证一次......

标签: java apache tomcat http2 tomcat9


【解决方案1】:

使用新下载的 Apache Tomcat 9.0.16 和您提供的 Connector 元素对其进行测试,对我来说没有错误或警告。向 UpgradeProtocol 元素属性(如 &lt;UpgradeProtocol maxConcurrentStreamExecutionTest="100".../&gt;)故意添加错字会导致以下警告:

警告:匹配 [Server/Service/Connector/UpgradeProtocol] 失败 将属性 [maxConcurrentStreamExecutionTest] 设置为 [100]

将此与您的警告日志消息进行比较:

2019 年 2 月 27 日 19:16:34.595 警告 [主要] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} 设置属性 'maxConcurrentStreamExecution' 到 '100' 没有找到匹配的 属性。

表示您错误地将这些属性添加到&lt;Connector/&gt; 元素而不是&lt;UpgradeProtocol/&gt; 元素。这也意味着您问题中提供的 Connector 元素不是为您的服务器配置的(唯一)一个。

【讨论】:

  • 你是对的,我也错误地添加了连接器标签。
猜你喜欢
  • 2015-03-29
  • 2011-04-03
  • 1970-01-01
  • 2017-04-14
  • 2014-03-10
  • 1970-01-01
  • 2023-03-17
  • 2019-07-04
相关资源
最近更新 更多