I have a tomcat 7 running on a low memory CentOS. Currently it has 2 connectors for ports 80 and 443. Important configuration options are:
<Connector port="80" protocol="HTTP/1.1" executor="tomcatThreadPool"
connectionTimeout="10000"
keepAliveTimeout="60000"
<Connector port="443" protocol="HTTP/1.1" executor="tomcatThreadPool"
SSLEnabled="true" scheme="https" secure="true"
connectionTimeout="10000"
keepAliveTimeout="60000"
Both connectors is bound to an executor:
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="100" minSpareThreads="3"
maxIdleTime="120000" />
When tomcat is first started, it starts about 50 threads. After about 15-20 users connecting to web application, it is increased to about 60. (I count tomcat threads with command ps -eLf | grep java |grep tomcat |wc -l
)
I have about 4 connections per minute, it is not more than 5 due to the nature of my application. Therefore I want tomcat to start minimum possible threads. Since I have configured minimum of 3 spare threads and keepalive as 2 minutes, it should not go over 20 or something. But I am wrong.
How can I limit the number of Tomcat threads to a minimum value like 20 or 30?