tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Max Threads - Worker Threads clarification
Date Wed, 24 Oct 2012 19:00:24 GMT
Hash: SHA1


On 10/24/12 12:21 PM, vivek aggarwal wrote:
> I have following understanding with regards to your trailing mail 
> comments ,pls do correct me if  that's not correct :-
> In (Apache end) we have directive called 
> "connection_pool_size" which is number of those connection that
> each Apache web server child process can made to the backend
> (Tomcat). So does that mean i should keep this
> "connection_pool_size" value in sync with threads configured for a
> given connector (http) in server.xml (Tomcat) in order to avoid
> thread exhaustion limit.

It's a little more complicated than that, because a threaded Tomcat
can have multiple connections per child process.

> Is there recommendation you have with respect to Apache-Tomcat 
> communication , that people like me ( naive) should keep in mind
> in order to avoid any connection time out/thread exhaustion/
> response time out erorrs ??

First of all: don't set a connection_pool_size in Apache httpd: httpd
will auto-detect the correct setting and use that. The logical default
values would be 1 for prefork MPM and ThreadsPerChild in a threaded
(worker, event, winnt, beos, netware, os2) MPM.

If you want to set your connection_pool_size to something *less* than
the default ThreadsPerChild that will mean that your httpd process can
accept more simultaneous connections than it can route to the Tomcat
backend. That might make sense for you, say, if you only expect that
roughly 50% of incoming requests will need to be sent to Tomcat. In
that case you might reduce your connection_pool_size to reclaim some
of those resources (and reduce the peak load that any one backend
Tomcat instance will experience).

The equation is very simple:

L  = number of load balancers (httpd if you choose)
Lc = number of connections each load balancer can handle
T  = number of backend Tomcat instances
Tc = number of connections each Tomcat *must* handle

Assume that all LB are connected to all TC such than any LB can
forward traffic to any TC instance.

Tc = L * Lc

Buried in the "Lc" number is MaxClients, ThreadsPerChild, etc. and
possibly the connection_pool_size if you've chosen to modify that.

Just make sure that every Tomcat instance has Tc threads configured in
the thread pool that serves the <Connector> you use to handle balanced

Next, you have to check to make sure that your workers
connection_pool_timeout is matched with your <Connector>'s
connectionTimeout. I say "matched" because the value in Tomcat is
expressed in ms while the connection_pool_timeout is expressed in
seconds. So, just make sure you add "000" to the end in your Tomcat
configuration. ;)

That's the basics.

- -chris
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools -
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message