[Mongrel] Setup with Apache 2.2 proxy balancer : timeout during uploads

Zed Shaw zedshaw at zedshaw.com
Fri Sep 1 18:22:53 EDT 2006

On Fri, 2006-09-01 at 14:42 +0200, Philippe Jayet wrote:
> > Yes, Mongrel processes the full request, including uploaded body before
> > calling rails (and locking it).  If the request is large then it also
> > streams the result to a tmpfile in order to not use up ram.
> You're doing an amazing job Zed :)

> > The response Rails generates is placed into an internal buffer and then
> > when Rails is done Mongrel unlocks rails and spends the rest of it's
> > time sending back the response.  This is necessary so that Rails can be
> > locked for the shortest amount of time.
> How does it interact with send_file and send_data? Which method is the
> best to use to serve files of serveral MB?

Ah, yes, problem with those is that they're run inside Rails, so they're
done during the lock and streamed out into the buffer mongrel hands to

Not a good combo.  You're actually *best* off using mod_xsendfile from
apache, which lets you write the giganto data to a file and then put an
"X-Sendfile" header in the response pointing at this file.  Apache will
then pick the file up as the response body and shoot it to the client
without bothering you.

Lighttpd also has this in the latest (unstable) version.

Zed A. Shaw
http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.

More information about the Mongrel-users mailing list