You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by marcobuc <ma...@edp-progetti.it> on 2012/08/23 09:50:53 UTC

Re: AW: Too many connections in keepalive state in jk threadpool

Hi,
we are experiencing a very similar problem with the difference that we are
using mod_proxy_ajp instead of mod_jk to connect Apache with tomcat. As for
mod_jk, the connection is done to the 8009-jk port opened by a connector
configured in tomcat server.xml file.
    <Connector port="8009"
               enableLookups="false" redirectPort="8443" protocol="AJP/1.3"
/>

We tried configuring the timeout parameters for mod_proxy_ajp to tell Apache
to drop connection older than 2 minutes, but we see in tomcat manager
application that the jk-8009 connector retains Keepalive connections open
for millions of milliseconds:
K	1783874292 ms	?	?	84.18.132.114	?	?

I would like to try configuring the ping_mode parameter but I do not know if
this is possible, i.e. if this parameter exists only for mod_jk.
Here an example of configuration we added in httpd.conf file for the
mod_proxy_ajp configuration.

ProxyPass /manager ajp://localhost:8009/manager max=10 retry=10 timeout=30
ttl=120
ProxyPassReverse /manager ajp://localhost:8009/manager

Thanks for any help,
Marco.




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

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


Re: Too many connections in keepalive state in jk threadpool

Posted by marcobuc <ma...@edp-progetti.it>.
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Too many connections in keepalive state in jk threadpool

Posted by Rainer Jung <ra...@kippdata.de>.
On 23.08.2012 09:50, marcobuc wrote:
> Hi,
> we are experiencing a very similar problem with the difference that we are
> using mod_proxy_ajp instead of mod_jk to connect Apache with tomcat. As for
> mod_jk, the connection is done to the 8009-jk port opened by a connector
> configured in tomcat server.xml file.
>      <Connector port="8009"
>                 enableLookups="false" redirectPort="8443" protocol="AJP/1.3"
> />
>
> We tried configuring the timeout parameters for mod_proxy_ajp to tell Apache
> to drop connection older than 2 minutes, but we see in tomcat manager
> application that the jk-8009 connector retains Keepalive connections open
> for millions of milliseconds:
> K	1783874292 ms	?	?	84.18.132.114	?	?

Can you see the connections in the output of "netstat -an"?

What is there state there?

> I would like to try configuring the ping_mode parameter but I do not know if
> this is possible, i.e. if this parameter exists only for mod_jk.
> Here an example of configuration we added in httpd.conf file for the
> mod_proxy_ajp configuration.
>
> ProxyPass /manager ajp://localhost:8009/manager max=10 retry=10 timeout=30
> ttl=120
> ProxyPassReverse /manager ajp://localhost:8009/manager

Look for "ping" and "ttl" on

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

if using 2.2 or

http://httpd.apache.org/docs/2.4/mod/mod_proxy.html

if using httpd 2.4. Note that for 2.4 there was a connection closing bug 
which was fixed very recently in 2.4.3.

Regards,

Rainer


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