tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <>
Subject Re: apache getting in "sending reply" state when connecting to tomcat
Date Thu, 30 Aug 2007 13:29:32 GMT wrote:
> Hi
> This part is still sligtly confusing to me:
> We have 575 potential connections that we can except on the httpd
> server, according to my understanding mod_jk will load balance these
> connections to the tomcat servers. Thus typically 48 connections  per
> tomcat. This does seem obviously wrong ...
> We are seeing avarage amount of connections of about 245 per tomcat
> server on the apache box when we reach a state were all servers are in
> "W" state. That is about 3000 connections in total over the 12 tomcats.
> This does not tally up with the default maximum of 200. Any ideas where
> this additional connections comes from??

Connection != Request

mod_jk uses persistant connections between Apache httpd and Tomcat. 
Because it's server to server communication one usually prefers not to 
establish a new connection for each new request.

By default mod_jk will open up at most as many connections from any 
httpd process to any backend, as there are threads in the httpd process. 
In your case you use the prefork MPM, which has only one thread per 
httpd process, so mod_jk will create at most one connection from each 
httpd process to each Tomcat backend. Connections are always httpd 
process private.

Connections are closed after some time of idleness, depending on 
configuration. By default they stay open forever. Check the 
connection_cache_* parameters for details.

Tomcat associates one thread with each incoming connection (at least the 
default connector) independant of it's idleness, i.e. even if there is 
no request coming in. The connectionTimeout parameter in the connector 
tells tomcat, howe long it should wait for a request, before shutting 
down the connection and putting back the thread into the pool of idle 

That's the reason, why you need to adjust the parameters between httpd 
and Tomcat.

The reason, why you have so many connections will be in some part of the 
webapp being to slow. This you will be able to analyze by using a Java 
thread dump.

> We feel confident that we don't have stale connections. Connections on
> the httpd side and connections on the tomcat side tally up. lsof on the
> tomcat box is also exactly the same as the netstat result.
> Commands used:
> [root@LONSTCT01AGX ~]# lsof|grep -i 8009 |grep -i established |grep -vi
> localhost -c
> 75
> [root@LONSTCT01AGX ~]#  netstat -ant|grep 8009 |awk '{print $5}'|awk -F:
> '{print $4}'|sort|uniq -c
>       8
>       1 *
>      75
>       8
> Regards



To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message