[Mongrel] Memory usage issues

Jason Burks jburks725 at gmail.com
Thu Jun 29 13:54:08 EDT 2006


Thanks for the feedback, I'll give it a try and report results.  I'm
on vacation all of next week and may not be able to send anything
until I return.

Also, thanks for the correction on Mongrel contributors, and thanks to
all of your for a great little app server.


On 6/29/06, Zed Shaw <zedshaw at zedshaw.com> wrote:
> On Thu, 2006-06-29 at 08:14 -0400, Jason Burks wrote:
> > Hello all,
> >
> > I'm new to Mongrel and am very impressed with what I see so far.  This
> > thing beats FastCGI hands down, and is even simpler to use than SCGI.
> > Great job Zed!  Thanks for all the hard work.
> >
> Thanks Jason, don't forget that Luis did a lot of work too and other
> folks like _why, Rick Olsen, and many others contributed code or
> documentation.  Just wanted to throw that in since many times people say
> I rock, but really it's all the people helping out that make Mongrel
> rock.
> > I am a bit surprised at the memory usage patterns though.  I'm not
> > sure if I'm doing something wrong (most likely I am), or if this is a
> > problem with the app I'm running (Typo trunk), but after the initial
> > mongrel_rails startup, each server uses about 22MB of memory.
> > However, after serving pages for a day or so, that memory usage will
> > have increased from 22MB to ~40MB.  If I leave the server running, it
> > just keeps climbing.  My memory usage with FastCGI was pretty stable
> > at about 22-24MB per dispatcher, regardless of how long they'd been
> > running.  I'm far from a high-traffic site, so this is a bit
> > unexpected.
> So, with memory usage you've got a few things potentially going on:
> 1) Ruby's GC just isn't all that great.  With FastCGI they actually had
> this lame "run the GC after X requests" thing, but Mongrel's just Ruby
> (mostly) so having that just seems wrong.
> 2) Typo actually does have a leak.  This is pretty unlikely since you
> say it ran under fastcgi.  I'm still betting on #1.
> 3) Mongrel has a leak.  Probably not, there's not a lot in Mongrel to
> leak, and many people use it without any problems.
> So, what I'd recommend is actually installing Monit and configuring it
> to watch your Mongrel processes for memory and CPU usage.  Monit will
> actually e-mail you when they reach certain limits and can even restart
> them.  Let this run for a while and keep the e-mails that monit sends so
> you can get a sense of how long before your application start to use too
> much ram.
> I'm thinking your issue is #1 (GC) so the ram will increase and then
> just go down, which is normal.
> Finally, try just throwing in a call to force the GC to run after
> certain requests and that might help you prove/disprove the above.
> --
> Zed A. Shaw
> http://www.zedshaw.com/
> http://mongrel.rubyforge.org/
> http://www.railsmachine.com/ -- Need Mongrel support?
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

More information about the Mongrel-users mailing list