server.tomcat.accept-count=100 # Maximum queue length for incoming connection requests when all possible request processing threads are in use.
server.tomcat.additional-tld-skip-patterns= # Comma-separated list of additional patterns that match jars to ignore for TLD scanning.
server.tomcat.background-processor-delay=10s # Delay between the invocation of backgroundProcess methods. If a duration suffix is not specified, seconds will be used.
server.tomcat.basedir= # Tomcat base directory. If not specified, a temporary directory is used.
server.tomcat.max-connections=10000 # Maximum number of connections that the server accepts and processes at any given time.
server.tomcat.max-http-header-size=0 # Maximum size in bytes of the HTTP message header.
server.tomcat.max-http-post-size=2097152 # Maximum size in bytes of the HTTP post content.
server.tomcat.max-threads=200 # Maximum amount of worker threads.
server.tomcat.min-spare-threads=10 # Minimum amount of worker threads.
server.tomcat.port-header=X-Forwarded-Port # Name of the HTTP header used to override the original port value.
server.tomcat.protocol-header= # Header that holds the incoming protocol, usually named "X-Forwarded-Proto".
server.tomcat.protocol-header-https-value=https # Value of the protocol header indicating whether the incoming request uses SSL.
server.tomcat.redirect-context-root=true # Whether requests to the context root should be redirected by appending a / to the path.
server.tomcat.remote-ip-header= # Name of the HTTP header from which the remote IP is extracted. For instance, `X-FORWARDED-FOR`.
server.tomcat.resource.cache-ttl= # Time-to-live of the static resource cache.
server.tomcat.uri-encoding=UTF-8 # Character encoding to use to decode the URI.
server.tomcat.use-relative-redirects= # Whether HTTP 1.1 and later location headers generated by a call to sendRedirect will use relative or absolute redirects.
5条答案
按热度按时间ma8fv8wu1#
此设置派生自嵌入式容器(tomcat,jetty...)。
Tomcat的线程数
您可以在www.example.com中指定此属性application.properties
您说您计算了20个线程,但是根据这个other stackoverflow question/answer,tomcat的默认线程数应该是200,因为server.tomcat.max-threads的默认值是0。参见tomcat's documentation:
此连接器要创建的请求处理线程的最大数量,因此它决定了可以处理的同时请求的最大数量。如果未指定,则此属性设置为200。如果执行器与此连接器相关联,则此属性将被忽略,因为连接器将使用执行器而不是内部线程池执行任务。
此外,以下项的属性:
*暗流:
server.undertow.worker-threads
*码头:
server.jetty.acceptors
您将在Spring's documentation中找到属性列表
goqiplq22#
也许,你可以看看springboot的配置
izkcnapc3#
虽然接受的答案是非常有用的,我最近经历了我认为是相同的问题,作为原来的海报。这是我能找到的唯一一个与我的经验直接相关的搜索结果,所以我想我应该添加我的解决方案,以防它能帮助到别人。
在我的例子中,观察到的并发限制20是由
org.apache.coyote.http2.Http2Protocol
中maxConcurrentStreamExecution
属性的默认设置20强加的。如果您遇到此问题并且正在使用HTTP/2,那么增加
maxConcurrentStreamExecution
很有可能会有所帮助。您可以在Tomcat Configuration Reference中找到更多信息,它实际上指出默认情况下应将其设置为200(而不是20)。但是,您可以在
org.apache.coyote.http2.Http2Protocol
中看到默认设置20,所以我不确定这是一个错字,还是只是在Tomcat的嵌入式版本中以不同的方式呈现。8aqjt8rx4#
如果你有执行器,你可以看到指标
/actuator/metrics/tomcat.threads.config.max
tomcat决定创造的实际价值是什么?/actuator/metrics/tomcat.threads.current
你可能会看到10,这取决于负载
spring Boot 似乎从来没有完全使用过max-threads,但是你可以从更多开始
esyap4oy5#
在Sping Boot 2中为HTTP/2增加
maxConcurrentStreamExecution
(设置200):