[Mongrel] Multiple mongrels for one app

Kirk Haines wyhaines at gmail.com
Tue Aug 22 15:30:22 EDT 2006

On 8/22/06, hax <hax at cheaphacks.info> wrote:

> So what happens when the mongrel gets more than one request at a time?
> When I run httpref against it, the mongrel process can serve up large
> number of rails pages before it gets bogged down.
> And when it does break, it says "mongrel timed out this thread: too
> many open files".  So it must be doing some threading, even if rails
> isn't threadsafe.
> If it was 1 request per mongrel process, 1 process shouldn't be able
> to serve up very many per second.  httpref tells me its prettty fast
> though.

Take a look at the Rails handler.  It's pretty easy code to read.

There is a guard mutex that makes sure that the Rails handler only
processes a single request through Rails at a time.  So, Mongrel
receives your requests and Mongrel multithreads them, but the Rails
handler only eats them one at a time.

If Rails could safely multithread, then the guard mutex and it's
synchronization (which you can turn off already if you really want to)
wouldn't be required, and overall performance on a single Mongrel, for
Rails, should be better.

Kirk Haines

More information about the Mongrel-users mailing list