[Mongrel] mongrel memory usage ballooning and process stomping

Matthew Whittaker mwhitt89 at gmail.com
Thu Jan 18 10:31:06 EST 2007


So in my application I am not using any of the mentioned culprits  
mentioned below which would cause the memory to balloon.

Here is my setup:
Debian 3.1
Rails 1.1.6
Ruby 1.8.5
Mongrel 0.3.18
Fastthread 0.6.1
Mongrel Cluster 0.2.1
Apache 2.2.3
Backgroundrb (can't find the version but it is the last one before 2.x)

Here is ps:
3265  0.0 15.9  75380 62860 ?        Sl   Jan10   1:01  
backgroundrb                                                             
                            TERM=vt100 SHELL=/bin/bash
9577  0.0 12.0  59448 47520 ?        Sl   Jan15   0:20 /usr/bin/ 
ruby1.8 /usr/bin/mongrel_rails start -d -e production -p 8000 -a  
127.0.0.1 -P log/mongrel.8000.pid -c
9580  0.0 10.4  53208 41012 ?        Sl   Jan15   0:11 /usr/bin/ 
ruby1.8 /usr/bin/mongrel_rails start -d -e production -p 8001 -a  
127.0.0.1 -P log/mongrel.8001.pid -c
9584  0.0 12.0  59808 47536 ?        Sl   Jan15   0:09 /usr/bin/ 
ruby1.8 /usr/bin/mongrel_rails start -d -e production -p 8002 -a  
127.0.0.1 -P log/mongrel.8002.pid -c

You can see that mongrel has slowly crept up to almost 60K of memory  
usage and backgroundrb is at 75K.  This app is not getting hammered  
and only has a steady usage. But every time I restart everything  
after a couple days everything creeps up to this high memory usage.

I am not using eager loading, nor RMagick.  Any ideas?  How should I  
troubleshoot this.

Thank you.

Matt




On Jan 17, 2007, at 2:34 PM, Ezra Zygmuntowicz wrote:

>
> 	Some linux distros have weird reporting of processes. I have seen it
> where top or ps will report 3 mongrels for each one that is really
> running. And looking at your output you can see that each set of
> three mongrels reported have the same port number. This means that
> you really only have 3 mongrels running because only one can be
> running per port at a time.
>
> 	As far as the memory usage goes, that sounds like a classic memory
> leak in your rails app. I have seen mongrel balloon like that when
> people add an extra :include directive to a find that ends up loading
> a ton of extra records into memory. If you are loading more then a
> few hundred ActiveRecords into memory on any one page then that will
> surely cause memory to ballon like this.
>
> 	A little more info about your app and what it does woudl help debug.
> Are you using Rmagcik? Are you useing send_file or send_data to
> stream out large content?
>
>
> Cheers-
> -Ezra
>
>
>
> On Jan 17, 2007, at 10:36 AM, Michael Biven wrote:
>
>> How are the mongrel started (cron, launchd, etc)? I had something
>> similar happen to me, but I think it was from the cluster being
>> started by root instead of the user I wanted to start it. It gave me
>> an extra set of mongrel processes running that mongrel_rails
>> cluster::stop wouldn't stop.
>>
>> Michael B.
>>
>> On 1/17/07, Surendra Singhi <singhi.surendra at gmail.com> wrote:
>>> Hi,
>>>   I have mongrel 0.3.14, with ruby 1.8.5, rails 1.1.6 and mongrel
>>> cluster
>>> 0.2.1, on debian sage 3.1 with apache 2.0, and fastthread 0.6.1.
>>> I am load balancing 3 mongrel processes using the random port trick.
>>>
>>>  When I start mongrel the processes have about 60MB, but after
>>> some hour of
>>> usage the memory ballons upto more than 180MB and the site becomes
>>> terribly
>>> slow. Forcing me to restart mongrel cluster.
>>>
>>> Also, it reports me 9 mongrel processes instead of three. I am not
>>> able to
>>> understand why that's happening. Are really 9 mongrel processes
>>> started
>>> instead of three?
>>>
>>> Please help. Thanks.
>>
>> -- 
>> Michael Biven
>> michael.biven at gmail.com
>> http://biven.org
>> _______________________________________________
>> Mongrel-users mailing list
>> Mongrel-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/mongrel-users
>
> -- Ezra Zygmuntowicz 
> -- Lead Rails Evangelist
> -- ez at engineyard.com
> -- Engine Yard, Serious Rails Hosting
> -- (866) 518-YARD (9273)
>
>
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users



More information about the Mongrel-users mailing list