论坛首页 Java企业应用论坛

Tomcat 6默认的maxThread,官方文档有错误

浏览 3120 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2010-04-20   最后修改:2010-04-26

  我们前段时间遇到一个很奇怪的问题,Tomcat6使用默认的配置,在进行压力测试时,老是报错,用Jmeter模拟40个用户并发时,正常,当超过60个时,居然全部报错,打开server.xml可以看到如下配置:

 

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

 

Tomcat的官方网站的解释如下, maxThread如果没有set,默认值为200.

 

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.

 

这个就产生问题了,打开Tomcat的源码发现默认值是40,而不是200,所以压力测试时

 

所以遇到同类的问题,大家一定要注意,添加以下配置:

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" maxThreads="150"/>

论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics