We are facing an issue for last many days that our tomcat(8.0.5) stop responding to web requests which are targeting to a servlet deployed on tomcat but requests are coming from our website deployed on apache(2.2) on centos.
After going through many docs and posts we have come to conclusion to set maxThreads (in server.xml of tomcat) to same as maxClients settings (in apache httpd.conf for prefork MPM ) i.e. 256. But when I have gone through the AJP docs here: https://tomcat.apache.org/tomcat-8.0-doc/config/ajp.html
I came to know that it should be tomcat's "maxConnections" rather than "maxThreads". My collegue is convinced to have it "maxThreads" while i think it should be "maxConnections", so can someone clarify this confusion on our part. By the way - maxThreads settings is working fine since we applied this. Regards.
The maxConnections means the max tcp connections that tomcat could establish, the maxThreads means max number of tomcat threads that could be used to process the requests from the connections.
I think in most cases, it is a good idea to set both number to be the same, tomcat 8 will set the maxConnections to the same number of maxThreads.
If you set the maxConnections to be larger than maxThreads, tomcat will establish more connections than the maxThreads, so there could be not enough number of threads to process the connections, and some connections will be blocked and wait for spare threads.
For BIO connectors if you set the maxThreads, the maxConnections is automatically changed by tomcat, For NIO and NIO2 the default is 10000. For APR/native, the default is 8192(Double checked tomcat docs, it said so). if you change the maxConnections, the maxThreads will NOT be changed accordingly.