Thank you for your reply Rainer,
with netstat -an I see a lot of connections in ESTABLISHED status on port
8009 coming from localhost so I think I can assume that those are the
connections established from Apache and Tomcat both residing on the same
machine. In any case on tomcat manager webapp I see all of them are in a K
state.

Googling and reading more carefully the documentation I came to this
discussion:
http://serverfault.com/questions/149171/keep-alive-header-not-sent-from-tomcat-5-5-http-connector

that moved my attention to the AJP connector configured in server.xml file
on tomcat. It seems the "connectionTimeout" parameter (doc says "The number
of milliseconds this Connector will wait, after accepting a connection, for
the request URI line to be presented. The default value is infinite (i.e. no
timeout).") is set to "infinite" and this affects the other parameter
"keepAliveTimeout" (doc says "The number of milliseconds this Connector will
wait for another AJP request before closing the connection. The default
value is to use the value that has been set for the connectionTimeout
attribute."). The keepAliveTimeout exists only for Tomcat 6+, for Tomcat 5.5
you can touch only connectionTimeout. I suppose that, without touching this
parameters, the connections remain open in K state also if they do not
receive a PING or a new request.
In any case, I tried to change values for this two parameters both in Tomcat
6.0 and Tomcat 5.5 and this seems to close the connections after the time
configured:

    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
               connectionTimeout="10000" keepAliveTimeout="10000"
    />

I tried with short values (for example 10s) and long ones (300s) and
everything seems to work correctly. I also did some tests with a jsp page
that takes a lot of time to serve the response and also in that cases
everything is working fine. If the page takes more time to respond than the
timeout the connection is not closed. If the page takes more time to respond
than the TIMEOUT and TTL configured on the Apache side, the browser gets a
proxy timeout error but on the server (tomcat manager app) I see my page in
Service state, till it finishes all its work.
Now I see in tomcat manager app that the list of connections in the pool is
normally very short, as expected. 

Thank you for your help,
Marco.





--
View this message in context: 
http://tomcat.10.n6.nabble.com/Too-many-connections-in-keepalive-state-in-jk-threadpool-tp4539290p4985607.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to