Apache + Tomcat with mod_jk: maxThread setting upon load balancing Apache + Tomcat with mod_jk: maxThread setting upon load balancing apache apache

Apache + Tomcat with mod_jk: maxThread setting upon load balancing


Setting maxThreads to 300 should be fine - there are no fixed rules. It depends on whether you see any connections being refused.

Increasing too much causes high memory consumption but production Tomcats are known to run with 750 threads. See here as well. http://java-monitor.com/forum/showthread.php?t=235

Have you actually got the SEVERE error? I've tested on our Tomcat 6.0.20 and it throws an INFO message when the maxThreads is crossed.

INFO: Maximum number of threads (200) created for connector with address null and port 8080

It does not refuse connections until the acceptCount value is crossed. The default is 100.

From the Tomcat docs http://tomcat.apache.org/tomcat-5.5-doc/config/http.html

The maximum queue length for incoming connection requests when all possible request processing threads are in use. Any requests received when the queue is full will be refused. The default value is 100.

The way it works is

1) As the number of simultaneous requests increase, threads will be created up to the configured maximum (the value of the maxThreads attribute).

So in your case, the message "Maximum number of threads (200) created" will appear at this point. However requests will still be queued for service.

2) If still more simultaneous requests are received, they are queued up to the configured maximum (the value of the acceptCount attribute).

Thus a total of 300 requests can be accepted without failure. (assuming your acceptCount is at default of 100)

3) Crossing this number throws Connection Refused errors, until resources are available to process them.

So you should be fine until you hit step 3