[Mongrel] Why Rails + mongrel_cluster + load balancing doesn't work for us and the beginning of a solution

Jens Kraemer kraemer at webit.de
Wed Sep 20 13:07:01 EDT 2006


On Wed, Sep 20, 2006 at 11:18:53AM +0100, Paul Butcher wrote:
> We have been searching for a Rails deployment architecture which works for
> us for some time. We've recently moved from Apache 1.3 + FastCGI to Apache
> 2.2 + mod_proxy_balancer + mongrel_cluster, and it's a significant
> improvement. But it still exhibits serious performance problems.

hey, cool, I really like the simplicity of your approach. 

However I tried to solve your problem with Pen, and here's what I got:

standard pen setup, no special options besides 'no sticky sessions' and
'non blocking mode':
pen -fndr 9000 localhost:9001 localhost:9002
Fast: 13
Slow: 6

just as predicted by you.

However, if I limit *one* of the mongrels to 1 connection at a time, I get
pen -fdnr 9000 localhost:9001:1 localhost:9002
Fast: 59
Slow: 6

When I limit both backend servers to only 1 connection the test script 
always bails out since pen doesn't seem to keep connections like you do 
in your queue, but closes them if it finds no server to dispatch to, so
it needs at least one backend process to pile up connections at when the
need arises.

I have no idea if this is a solution that would be useful under real life
conditions, but found the behaviour quite interesting.

I also raised the number of threads requesting the fast action, which
led to more successful requests on the fast action, and (sometimes) less 
on the slow one, i.e.
Fast: 67-69
Slow: 5-6
with 10 threads accessing the fast action.

Whatever load balancing you use, you'll always need to have more
Mongrels than there are concurrent requests for 'slow' actions to avoid
delays for clients requesting a 'fast' action.

So maybe, if the slow actions are well known, one could just reserve a
pool of Mongrels for these slow actions, and another one for the fast


webit! Gesellschaft für neue Medien mbH          www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer       kraemer at webit.de
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66

More information about the Mongrel-users mailing list