On 08.04.2009 08:23, feedly team wrote:
> We are running apache and tomcat on the same machine (using the http
> connector) and logging requests in both. Occasionally (maybe 1% of
> requests) we see 502 response in the apache log spread fairly evenly
> throughout the day. these requests don't appear in the tomcat log
> produced by the access valve. in the apache error log I see:
> 
> proxy: error reading status line from remote server 127.0.0.1
> proxy: Error reading from remote server returned by [url]
> 
> The requests are a mix of methods (GET/POST/PUT) of pretty small
> bodies and responses, generally under 1k.
> 
> We added request time (%T) in the apache logs and many of the requests
> have 0 response time so I don't think it's a timeout issue. Reading
> the tomcat connector documentation, I tried increasing the maxThreads
> to 100 and backlog to 1000 in the http connector since it seemed like
> with the default settings a burst of traffic may cause this issue.
> This didn't solve the problem. I have done periodic thread dumps and
> it looks like the number of http threads doesn't get past 80.
> 
> concerning machine resources, cpu is not loaded at all (~10%
> utilization). i checked file descriptor usage, it's about 400 and
> there is a per process limit of 1024.
> 
> I am not sure if this should be posted to the apache list or tomcat
> list, but thought i would start here since to me it seems more likely
> that I am not configuring tomcat correctly as opposed to some problem
> in apache. I have searched the web quite a bit, but nothing seems to
> fit. The next thing I will try is to use the AJP connector. But even
> if it gets rid of the problem, I am worried it may reappear once
> traffic increases. Has anyone experienced a similar problem?

I guess it's the usual HTTP Keep-Alive race with mod_proxy_http.
The connections between Apache and Tomcat are only reused for a certain
amount of time. What happens every now and then is that httpd thinks it
has a valid connection and sends the next data, but in parallel Tomcat
detects the HTTP KeepAlive has timed out and closes the connection.

There have been improvements in newer 2.2.x versions (latest is 2.2.11).
You should especially look at the various pool size and timeout
configuration attributes on the mod_proxy documentation page and also at
the Keepalive configuration values for the Tomcat HTTP connector you are
using.

> other stuff:
> OS: CentOS
> apache: 2.2.3, using mod_proxy
> tomcat: 6.0.16
> using netstat, i see a moderate number (~80) of tomcat's sockets in
> the CLOSE_WAIT state, not sure if this is relevant.

I assume Apache and Tomcat are on separate systems, and you notice
CLOSE_WAIT when doing netstat on the Tomcat system and the connections
are proxy connections? Then this means Apache has closed a connection
and Tomcat would still use it. Investigate the related timeout
parameters as suggested above.

Regards,

Rainer

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

Reply via email to