简体   繁体   English

Tomcat线程池?在tomcat.conf中注释掉,我应该使用它吗?

[英]Tomcat thread pool? Commented out in tomcat.conf, should I use it?

I really don't consider myself a java or tomcat expert. 我真的不认为自己是java或tomcat专家。 I have a vps with tomcat running on it. 我有一个运行tomcat的vps。 In the tomcat.conf file there is the following. 在tomcat.conf文件中有以下内容。

Notice that the Excecutor 'tomcatThreadPool' and corresponding Connector referencing that Executor is commented out. 请注意, Excecutor 'tomcatThreadPool'和引用该Executor相应Connector Executor已被注释掉。

At the risk of sounding very stupid...I'm going to ask this question... 冒着听起来非常愚蠢的风险......我会问这个问题......

With the Executor and Connector commented out, how are my servlets functioning? ExecutorConnector注释掉之后,我的servlet如何运行? In other words, are they using a default thread pool? 换句话说,他们是否使用默认线程池? Or should I uncomment the Executor and Connector for servlet efficiency? 或者我应该取消注释ExecutorConnector的servlet效率?

I guess I'm not very knowledgeable in this area at all.... 我想我在这个领域根本不是很了解......

<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" 
    maxThreads="150" minSpareThreads="4"/>
-->

<Connector port="8080" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
           port="8080" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" />
-->

The Tomcat documentation of Executor says (emphasis is mine): ExecutorTomcat文档说(重点是我的):

The Executor represents a thread pool that can be shared between components in Tomcat. Executor表示可以在Tomcat中的组件之间共享的线程池。 Historically there has been a thread pool per connector created but this allows you to share a thread pool , between (primarly) connector but also other components when those get configured to support executors 从历史上看,每个连接器都创建了一个线程池 ,但这允许您在(主要)连接器之间共享一个线程池 ,但是当这些连接器配置为支持执行器时,还可以共享其他组件

So, you don't have to uncomment anything for Tomcat to work efficently, the Executor is for special needs as using more than one executor or using some thread pool yourself. 因此,您不必为了使Tomcat有效工作而取消注释,Executor可以满足特殊需求,例如使用多个执行程序或自己使用某个线程池。

The referenced tomcat page is in the first results if you google " Tomcat Executor ", by the way. 顺便说一句,如果你谷歌“ Tomcat Executor ”,那么引用的tomcat页面就会出现在第一个结果中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM