tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <billwbar...@verizon.net>
Subject Re: Apache / mod_proxy / Tomcat
Date Sat, 06 Feb 2010 02:37:52 GMT


"André Warnier" <aw@ice-sa.com> wrote in message 
news:4B6CA79C.3090803@ice-sa.com...
> Farid Izem wrote:
>> Hi,
>>
>> I have setup an Apache Web Server in front of a Tomcat Web Container.
>> Basically, All request are handle by Apache and passed to Tomcat using
>> mod_proxy_ajp
>> Apache is binded on the IP address of the computer, tomcat is binded
>> on localhost:8009
>> When i take a look at the tomcat manager, i see that a lot of Tomcat
>> Thread with the status keepalive from the same source IP address.
>>
>> The main configuration of :
>> ProxyPass                 /webapp ajp://localhost:8009/webapps retry=30
>> ProxyPassReverse     /webapp ajp://localhost:8009/webapps
>>
>> Would it be possible to free the connection from Apache Server to
>> Tomcat server ?
>> Netstat show a lot of established connections but there is not data sent.
>> How could we free these keepalive connections that are being
>> maintained between Apache and Tomcat.
>>
>> i tryied
>> ProxyPass                 /webapp ajp://localhost:8009/webapps
>> retry=30 disablereuse=On
>> but this is not recognize.
>>
> I don't know about the above settings.
> Apart from what Chuck mentioned, what is the setting, in the Apache httpd 
> configuration, of the KeepAliveTimeout ?
>
> If you set that to 30 seconds, then it means that after the browser sent 
> the last request that it is ever going to send, Apache will maintain the 
> connection with the browser for 30 seconds, waiting for another request 
> that will never come.
> That probably means that it will also maintain the connection with Tomcat, 
> and thus that Tomcat will keep the corresponding thread waiting for the 
> same time, all for nothing.
> Set KeepAliveTimeout to 3 for example, and see what happens.

That will help Apache, but will have a relatively small effect on number of 
AJP/1.3 connections.  That is because the AJP/1.3 connections are shared 
across different browser connections by design (and why not clearing data in 
a ThreadLocal can end up sharing data between users).  And with the default 
settings, AJP/1.3 connections last forever.

If someone actually cares about the number of connections (which some old 
Linux kernels do), then set a connectionTimeout to a reasonable value (say 
5min) in the Tomcat <Connector />  tag in server.xml.  That will cause 
Tomcat to close the connection when it times out, and Apache can establish a 
new connection when necessary.  With mod_jk, this works best if you also 
configure it to use cping/cpong. 



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


Mime
View raw message