[Mongrel] Memory leaks in my site

Zed A. Shaw zedshaw at zedshaw.com
Thu Mar 8 16:38:27 EST 2007

On Thu, 8 Mar 2007 09:52:09 -0700
"Alexey Verkhovsky" <alexey.verkhovsky at gmail.com> wrote:

> On 3/8/07, Zed A. Shaw <zedshaw at zedshaw.com> wrote:
> >
> >  C'mon, Java processes typically hit the 600M or even
> > 2G ranges and that's just common place.
> Java runtime is a bloat. But its processes are natively multi-threaded and
> can serve multiple apps from the same server. So, one Java process should
> probably be compared with about 5-10 Rails processes in terms of RAM
> footprint. It's still a bloat.
> Even better, why are people complaining about the memory footprint of
> > RAILS on the MONGREL mailing list?
> Not guilty. In this thread, I am complaining about Mongrel's memory
> footprint, not "Hello, World"'s. :)
> Besides, I'm not even complaining, just trying to understand the ins and
> outs of this stack, and what can or cannot be squeezed out of it.

No, you're still testing Rails' memory usage.  If you want to test
Mongrel's you need to write a non-rails Mongrel handler that does
hello world.  For example, here's the tests I run to make sure that I
haven't destroyed Mongrel's memory usage:

Mongrel	Hello	20844	10564
Mongrel	Rails	56092	39512
Webrick	Hello	15180	4916
Webrick	Rails	56548	39924
ruby	IRB	4756	3252
ruby	IRB_Thr	12952	3376

IRB_Thr is just irb run with a single thread in sleep.  The two Hello
apps are pretty close to the same, and the Rails apps are the exact
same and show usage after the handling the same number of requests.

What you can see is even though Webrick is smaller than
Mongrel, it still ends up being the same size when it runs under
Rails.  That's why I say look at Rails if you want to save memory.
Even if you stripped Mongrel down to the absolute essentials, the
absolute impossible best is IRB_Thr.  If you could get Mongrel down to
Webrick's size, the test also shows it doesn't matter since the memory
goes up to the same as when running mongrel anyway.

No matter what, if you want to save memory you've gotta look at Rails
and not Mongrel.

Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
http://www.awprofessional.com/title/0321483502 -- The Mongrel Book

More information about the Mongrel-users mailing list