Tomcat配置文件server.xml中connector的参数minSpareThreads和maxSpareThreads

博客探讨了Tomcat配置文件server.xml中关于connector标签的minSpareThreads和maxSpareThreads参数的问题。作者指出,虽然在Tomcat 5.5文档中这两个属性存在,但在Tomcat 6.0及7.0的官方文档中并未提及。对于minSpareThreads,Tomcat 7.0将其默认值改为10,而maxSpareThreads在Tomcat 6.0文档中消失,引发疑问:这些参数在Tomcat 6.0中是否仍有效并如何工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在网上看到很多tomcat6.0的优化文章中,都提到了在server.xml中的connector标签中,加上[b]minSpareThreads[/b] 和 [b]maxSpareThreads[/b]属性,可是我到了tomcat的官网上去看文档,发现tomcat6.0中connector标签根本没有这两个属性,在tomcat5.5中才有。
tomcat5.5的文档连接:[u]http://tomcat.apache.org/tomcat-5.5-doc/config/http.html[/u]
里面原文是这样介绍这两个属性的:
maxSpareThreads:The maximum number of unused request processing threads that will be allowed to exist until the thread pool starts stopping the unnecessary threads. The default value is 50.
自己翻译一下,不知道是否正确:
maxSpareThreads:直到线程池开始停止不需要的线程时,允许存在空闲请求处理线程的最大数量。默认值50.
我的理解是这样的,当空闲的线程超过maxSpareThreads时,tomcat就关闭超出这个数值的线程。
网上的说法都是复制粘贴的,如下:
maxSpareThreads:最大备用线程数,一旦创建的线程超过这个值,Tomcat就会关闭不再需要的socket线程。
我觉得和我的理解是不同的。

再说,minSpareThreads。
minSpareThreads:The number of request processing threads that will be created when this Connector is first started. The connector will also make sure it has the specified number of idle processing threads available. This attribute should be set to a value smaller than that set for maxThreads. The default value is 4.
大概意思就是:初始会建立的线程数,并且确保最少会有这么多个线程数可用,并且设定的值要比参数[b]maxThreads[/b]大。默认值是4.

以上是tomcat5.5的文档写的内容,到了tomcat6.0,文档里面根本就没有介绍这两个参数,难道是写文档的人落了这两个参数没有写?文档地址如下:
[u]http://tomcat.apache.org/tomcat-6.0-doc/config/http.html[/u]
可是网上都说tomcat6.0优化要写这两个参数,是为什么???

到了tomcat7.0的时候,只有minSpareThreads了。文档地址如下:
[u]http://tomcat.apache.org/tomcat-7.0-doc/config/http.html[/u]
tomcat7.0对minSpareThreads的介绍也发生了变化:
minSpareThreads:The minimum number of threads always kept running. If not specified, the default of 10 is used.
大家可以看到,默认值是10个了。

所以大家可否分享一下各自的知识,tomcat6.0究竟是有没有这两个参数呢?
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值