Tomcat参数之maxThreads

Tomcat参数之maxThreads

  • maxThreads参数设置方式
    • Connector节点配置
    • Executor节点配置

maxThreads参数设置方式

从tomcat官网可以看到,tomcat的conf/server.xml文件中有两个节点可以设置maxThreads参数,下面分别介绍

Connector节点配置

Connector配置maxThreads官网原文如下:
The maximum number of request processing threads to be created by this Connector, which therefore determines the maximum number of simultaneous requests that can be handled. If not specified, this attribute is set to 200. If an executor is associated with this connector, this attribute is ignored as the connector will execute tasks using the executor rather than an internal thread pool. Note that if an executor is configured any value set for this attribute will be recorded correctly but it will be reported (e.g. via JMX) as -1 to make clear that it is not used.
意思是改属性配置了处理并发请求的最大线程数,如果不配置默认值是200. 如果配置了executor属性,这个属性会被忽略。注意斜体部分提到:如果executor设置了值,使用JMX查看的时候这个值会是-1,这是正常的。
Tomcat官网Connector配置地址:https://tomcat.apache.org/tomcat-8.5-doc/config/http.html

Executor节点配置

Executor配置maxThreads官网原文如下:
** (int) The max number of active threads in this pool, default is 200**
这个说得就比较简单了,意思是使用这个线程池来管理tomcat最大线程数,默认值为200。
Tomcat官网Executor配置地址:https://tomcat.apache.org/tomcat-8.5-doc/config/executor.html

你可能感兴趣的:(Tomcat)