[Mongrel] Long-running pages cause mongrel time-outs

Ezra Zygmuntowicz ezmobius at gmail.com
Mon Dec 17 19:18:30 EST 2007


On Dec 17, 2007, at 4:10 PM, Michael Van Wie wrote:

> Hi all,
>
> We use mongrel behind apache (using mod_proxy_balancer) to run an  
> internal app for our business. Lately we've been seeing frequent  
> errors from some of our mongrel processes.
>
> [Sun Dec 16 08:48:47 2007] [error] [client <CLIENT1>] (70007)The  
> timeout specified has expired: proxy: error reading status line from  
> remote server 127.0.0.1, referer: http://<long-running-request>
> [Sun Dec 16 08:48:47 2007] [error] [client <CLIENT1>] proxy: Error  
> reading from remote server returned by /<long-running-request>,  
> referer: http://<long-running-request>
> [Sun Dec 16 08:49:08 2007] [error] [client <CLIENT2>] (70007)The  
> timeout specified has expired: proxy: error reading status line from  
> remote server 127.0.0.1
> [Sun Dec 16 08:49:08 2007] [error] [client <CLIENT2>] proxy: Error  
> reading from remote server returned by /<not-so-long-running-request>
>
> The problem seems to be that the long-running request hogs a mongrel  
> process, and when apache sends the next request to it (after a round- 
> robin tour through the other 9 mongrels), that request times out  
> too. The original action eventually comes back, but sometimes not  
> for several minutes, so we can timeout on many requests in a row.
>
> I've seen problems like this mentioned in the context of file  
> uploads (which explain some of our long-running requests), but I've  
> never seen a fix posted. Maybe I haven't looked hard enough? Does  
> anyone know of a config fix that will skip over these blocked  
> processes?
>
> Thanks!
> Mike
>

	The best thing to do is to move any of your long running tasks off  
into a work queue and out of the mongrel/rails request response cycle.  
Something like Bj woudl help:

http://codeforpeople.rubyforge.org/svn/bj/trunk/README

	But I think there has been apache mod_proxy_balancer configs posted  
to this list in the past few months that will only send one request to  
a mongrel at a time, search the archives.

	or if you can use nginx instead there is a new fair proxy balancer  
for nginx that works well.

http://brainspl.at/articles/2007/11/09/a-fair-proxy-balancer-for-nginx-and-mongrel

Cheers-
- Ezra Zygmuntowicz
-- Founder & Software Architect
-- ezra at engineyard.com
-- EngineYard.com



More information about the Mongrel-users mailing list