File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Reusing Apache-Tomcat connections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Reusing Apache-Tomcat connections" Watch "Reusing Apache-Tomcat connections" New topic

Reusing Apache-Tomcat connections

Ramdas Hegde

Joined: Apr 07, 2003
Posts: 5
Reposting this from the JBoss Tomcat forum (

My application uses JBoss 3.2.6 running Tomcat 5.5 on a 2.4 Debian Linux kernel. I have not specified the connectionTimeout attribute on the AJP connector between Apache and Tomcat - with the idea that the connections get reused between web requests. There is no KeepAlive persistent connections between the http client and the Apache webserver.

I notice that the number of Tomcat threads that are being used to KeepAlive the connections between Apache and Tomcat is much higher than the concurrent number of http requests coming into Apache. Since the number of requests coming into the webserver is fairly even and known up front, i was hoping to have a permanent connection between Apache and Tomcat without having to tear down the connection for every request coming into the Apache webserver. But over a period of time, almost all the Tomcat threads in the pool are in the KeepAlive state and Apache instead of reusing one of the existing threads, seems to ask for a new thread and is unable to find one, resulting in connection latency. Was wondering if this is expected behaviour and does applying a connectionTimeout to force unused connections between Apache and Tomcat make sense?
Here is the stack showing the status of the Tomcat threads

"TP-Processor400" daemon prio=1 tid=0x08d430a0 nid=0x5c0 runnable [34bff000..34bff8d0]
at Method)
- locked <0x666cebf0> (a
at org.apache.jk.common.ChannelSocket.receive(
at org.apache.jk.common.ChannelSocket.processConnection(
at org.apache.jk.common.SocketConnection.runIt(
at org.apache.tomcat.util.threads.ThreadPool$
wood burning stoves
subject: Reusing Apache-Tomcat connections
It's not a secret anymore!