Reposting this from the JBoss Tomcat forum (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=114458
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 java.net.SocketInputStream.socketRead0(Native Method)
- locked <0x666cebf0> (a java.io.BufferedInputStream)