[Mongrel] Determining ideal number of Mongrels for an app?

Joe Ruby joeat303 at yahoo.com
Tue Nov 28 20:51:58 EST 2006

> On Tue, 28 Nov 2006 08:27:38 -0800 (PST)
> Joe Ruby <joeat303 at yahoo.com> wrote:
> > What's a rule of thumb for guesstimating how many
> > Mongrels to use in a cluster for an app? I have an
> > that gets about 5000 unique visitors per day. 
> Pathetic.  5000/day?  Sad.  Oh wait, is that 5000
visitors doing 100k request/second during the whole
day, or 5000 visitors doing .005 request/second at

It's both! Yeah, it's pathetic and sad, but you think
I trust my enterprisey apps to this script-kiddy RoR
stuff?!? :P

> (I'm jokingly saying you should find out what their
usage pattern is and translate that to req/sec
processed and kb/second transfered first.)
> > I figured I'd give it plenty of Mongrels -- twenty
to be
> > specific. After running out of memory and hitting
> > swap periodically, I scaled it back to five and it
> > still seems to serve up visitors fine. So, is
> > some super-secret math fomula I can use to
> > the ideal number of Mongrels I should start in a
> > cluster for an app?
> Many folks pointed you at the semi-official tuning
documentation.  20 is totally over kill and will hurt
you more than you know.  I find it's about 2-4/CPU
depending on the amount of ram you have and the speed
NO MATTER WHAT YOU CHANGED.  Don't believe anything as
gospel, always test it yourself.
> Now, lately I've been wanting to add a couple of
qualifiers on the scaling issue related to your
resource usage.  In some situations people are using
up tons of ram or tons of files.  If you have 2-4
mongrels you quickly outstrip the ram and files.  For
these folks I tell them to do a different test that
tries to do a lot of concurrent but slow connections
to eat up as much ram and file handles as they can. 
Then, they expand the mongrels out to handle the
number of connections they need.  Many times, people
in these situations have to buy more machines.

I know you like doing long lines (scroll, scroll,
scroll), but check it, yo:


> A joke page about Mongrel MUDCRAP certification that
hasn't changed but is now accesible from the site
menu: http://mongrel.rubyforge.org/certified.html

A JOKE?!? W. T. F. ?!?

> The main culprit of this is RMagick.  If you have
RMagick you need to simulate a ton of people
concurrently slamming you with files to make sure you
have the resources.
> This is also a reasonably good description of file
limit defaults and HTTP performance:
> Play with these settings as well for each, maybe
even just increasing the defaults.

But seriously, thanks for the tips. :)


> -- 
> Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
> http://www.zedshaw.com/
> http://www.awprofessional.com/title/0321483502 --
The Mongrel Book
> http://mongrel.rubyforge.org/
> http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.

More information about the Mongrel-users mailing list