tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Reisler" <>
Subject Delays in mod_jk
Date Wed, 24 Oct 2007 11:55:05 GMT
We are running JBOSS 4.21GA(Tomcat 6.0.10) with mod_jk 1.25 on Apache 2.2.x, and have run into
something of a performance issue.  

We have the system setup so that threads on mod_jk and tomcat timeout after 10 minutes (an
heuristic which has been discussed in some of the documentation) using the properties on the
mod_jk side:
worker.node1.connection_pool_timeout=600,and on the Tomcat side connectionTimeout="600000".

We have noticed that some transactions to the apache server were running slow.  After looking
at the logs, the mod_jk logs indicated that the transaction executed relatively quickly (eg.
< .03 seconds) whereas the apache access logs indicated that the transaction took something
more like 2.040 seconds.  After enabling trace logs on mod_jk, it became clear that sometimes
before executing a transaction, mod_jk would call the maintain function, which in turn would
close sockets that had exceeded the time limit of 10 minutes using jk_shutdown_socket.   As
per the code message in jk_shutdown_socket, the socket would take two seconds to shut down,
causing a delay (sometimes it would shut down two or three sockets, resulting in a delay of
2,4, or 6 seconds).  The time spent doing the maintenance was before the real work of sending
the data to Tomcat, so the mod_jk.log did not reflect that in its timing.  Nevertheless, the
transactions are being delayed.

I found that the number of delays was directly related to the connection_pool_timeout: a higher
timeout meant fewer delays – this is what I would have expected given my understanding of
the problem.

I tried setting worker.maintain on the mod_jk side to 10 seconds, but the problem still occurs.

A couple of questions come out of this:
1.  Should the thread processing the request be running maintain at all?  My understanding
is that there is a separate maintenance thread that is running by default every 60 seconds.
 Can’t that thread perform the maintenance exclusively?
2.  If the processing thread does have to run the maintain function, then maybe it could simply
place the expired sockets on a queue for later processing by the maintain thread, or perhaps
send the FIN packet and then place them on a queue.
3.  Is there some reason that Tomcat would not be sending the FIN packet to mod_jk immediately?

Larry Reisler


Come meet Vringo at the following events...

October 16-17 Symbian Smartphone Show, London UK

October 22-24 CTIA San Francisco, CA

October 24-25 Media and Tech Roundtable Beijing, China

October 30-31 VON Boston, MA

Nov 4-6 Rutberg Wireless Influencers, Laguna Niguel, CA


Would be delighted to see you.

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

View raw message