httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Manolache <>
Subject Re: Setting response timeout
Date Mon, 25 Jun 2012 14:39:10 GMT
On 2012-06-25 14:42, Rajalakshmi Iyer wrote:
> Hello,
> I am working on an Apache module where the response times for each request
> are very stringent. I want to be able to return a custom error deck in case
> I am not able to process the request within the threshold instead of a
> timeout response. I have added a check in the request handler code to check
> if a threshold time has elapsed and return a custom error in that case.
> However it appears that this code is not invoked at all for most requests.
>>From what I see in Apache code, the request / response is actually
> synchronous. So the next request is not read in until the response for the
> first one is sent out.

Yes, it is synchronous _at thread level_, i.e. each thread must finish 
processing its request before it is able to process a new one. But the 
server has several threads.

> So, if a previous request takes a longer time, the response times for
> subsequent requests is affected.

No, subsequent requests are taken up by other threads/processes of the 

> Any guidelines on how to handle this would be greatly appreciated.

It depends on what is eating up the response time and on the granularity 
of the timeout.

*) If it's processing time on the server, you'll need a timer (see for 
example boost::asio::deadline_timer).

*) If it's a the response of a backend server you are waiting on then 
the timeout mechanism depends on the way in which the request is made to 
the backend. If you're using mod_proxy, then you could use the timeout 
directive of ProxyPass if its coarse granularity suits your 
requirements. I suppose other http client libs have their own way to 
specify timeouts.


View raw message