Topic: Mongrel memory usage - how much do your mongrels use?

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
www-data 13793  1.0 21.6 255452 113364 ?       Sl   11:12   5:54 /usr/bin/ruby1.8 ...
www-data 13796  0.9 21.9 258480 115012 ?       Sl   11:12   5:35 /usr/bin/ruby1.8 ...

I've had a hard time getting good, hard numbers on people's mongrel memory usage.  My hunch is that mine is quite high, but before I got nuts chasing down memory leaks and inefficiencies, I'd like to know what others' mongrels look like.

I've pasted the output from ps.  I think it's important to show both the RSS and the VSZ, since this shows how much is in memory vs how much is in swap space, correct?

For a little background, we've got a fairly standard web app that's doing some captchas and thumbnailing with RMagick, and I can't think of anything else funky.  That's why I'm thinking that my memory usage is just too darn high.  Otherwise, it might be time to upgrade from my 512MB VPS to a full 1G.

Please post your own memory usage, if you don't mind, and give an overview of anything special about your setup (RMagick and/or other intensive libraries).

Thanks,
Micah

If there is a post/website/blog entry/whatever that answers my questions, please don't hesitate to simply post a link.  I know it can get old fast to answer the same question hundreds of times...

Re: Mongrel memory usage - how much do your mongrels use?

Ours average about 150mb. Thats probably with about 30 models.

I let "God" restart them at about 190mb. Runs fairly smooth.

Re: Mongrel memory usage - how much do your mongrels use?

I run two mongrels.  From a clean start they go to about 56mb each.  After i run through about 10 searches and pages on our site to exercise it a bit, they go to 66mb each.  When I come back in a day they are at 99mb.

They seem to be using more lately too (which is how I came to this thread) and we're seeing some swapping (I only have a 256mb slice from slicehost).

My blog: www.StartBreakingFree.com
My first rails app: www.UniversityTutor.com
My second rails app: www.BuyersVote.com

Re: Mongrel memory usage - how much do your mongrels use?

krypton1 wrote:

I run two mongrels.  From a clean start they go to about 56mb each.  After i run through about 10 searches and pages on our site to exercise it a bit, they go to 66mb each.  When I come back in a day they are at 99mb.

They seem to be using more lately too (which is how I came to this thread) and we're seeing some swapping (I only have a 256mb slice from slicehost).

As more people hit your site and it loads the pages then the mongrels bloat as it holds the pages in memory since they don't get reloading after every request. Ruby does seem to have a few memory leaks as well so that memory you don't get back, which is why a lot of people run monit or god to restart their mongrels if they bloat too far.

If you are getting to 99MB after one day then I would say that a 256MB host on slicehost is insufficient for your site.