Re: [Mongrel] mongrel memory usage ballooning and process stomping

2007-01-19 Thread Michael D'Auria

Hunter,

I would just install it without using ports, you can check out the
image_science page for info on how to compile with specific Mac OSX tips.


On 1/18/07, Hunter Hillegas [EMAIL PROTECTED] wrote:


I'm interested in trying ImageScience but I can't get FreeImage, the
processing lib, to build on MacOS X 10.4 (Intel). Has anyone had luck?

I tried building from source and using DarwinPorts, both no dice:

gonzo:~/Unix/Sources/imagescience_stuff/FreeImage hunter$ sudo port
install freeimage
---  Building freeimage with target all
Error: Target com.apple.build returned: shell command cd /opt/local/
var/db/dports/build/
_opt_local_var_db_dports_sources_rsync.rsync.darwinports.org_dpupdate_dp
orts_graphics_freeimage/work/FreeImage  make all returned error 2
Command output: Source/FreeImage/BitmapAccess.cpp:813: error:
expected `;' before 'TAGMAP'
Source/FreeImage/BitmapAccess.cpp:821: error: 'strcmp' was not
declared in this scope
Source/FreeImage/BitmapAccess.cpp:825: error: 'FreeImage_GetTagCount'
was not declared in this scope
Source/FreeImage/BitmapAccess.cpp:825: error: 'WORD' was not declared
in this scope
Source/FreeImage/BitmapAccess.cpp:825: error:
'FreeImage_TagDataWidth' cannot be used as a function
Source/FreeImage/BitmapAccess.cpp:825: error:
'FreeImage_GetTagLength' was not declared in this scope
Source/FreeImage/BitmapAccess.cpp:839: error: 'WORD' was not declared
in this scope
Source/FreeImage/BitmapAccess.cpp:858: error: 'TAGMAP' is not a class
or namespace
Source/FreeImage/BitmapAccess.cpp:858: error: 'iterator' was not
declared in this scope
Source/FreeImage/BitmapAccess.cpp:858: error: expected `;' before 'i'
Source/FreeImage/BitmapAccess.cpp:859: error: 'i' was not declared in
this scope
Source/FreeImage/BitmapAccess.cpp:869: error: 'TAGMAP' is not a class
or namespace
Source/FreeImage/BitmapAccess.cpp:869: error: 'iterator' was not
declared in this scope
Source/FreeImage/BitmapAccess.cpp:869: error: expected `;' before 'i'
Source/FreeImage/BitmapAccess.cpp:869: error: 'i' was not declared in
this scope
Source/FreeImage/BitmapAccess.cpp:874: error: type 'type error'
argument given to 'delete', expected pointer
Source/FreeImage/BitmapAccess.cpp: In function 'BOOL
FreeImage_GetMetadata(FREE_IMAGE_MDMODEL, FIBITMAP*, const char*,
FITAG**)':
Source/FreeImage/BitmapAccess.cpp:887: error: 'TAGMAP' was not
declared in this scope
Source/FreeImage/BitmapAccess.cpp:887: error: 'tagmap' was not
declared in this scope
Source/FreeImage/BitmapAccess.cpp:891: error: 'METADATAMAP' was not
declared in this scope
Source/FreeImage/BitmapAccess.cpp:891: error: 'metadata' was not
declared in this scope
Source/FreeImage/BitmapAccess.cpp:891: error: 'struct
FREEIMAGEHEADER' has no member named 'metadata'
Source/FreeImage/BitmapAccess.cpp: In function 'unsigned int
FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL, FIBITMAP*)':
Source/FreeImage/BitmapAccess.cpp:912: error: 'TAGMAP' was not
declared in this scope
Source/FreeImage/BitmapAccess.cpp:912: error: 'tagmap' was not
declared in this scope
Source/FreeImage/BitmapAccess.cpp:915: error: 'METADATAMAP' was not
declared in this scope
Source/FreeImage/BitmapAccess.cpp:915: error: 'metadata' was not
declared in this scope
Source/FreeImage/BitmapAccess.cpp:915: error: 'struct
FREEIMAGEHEADER' has no member named 'metadata'
make[1]: *** [Source/FreeImage/BitmapAccess.o-ppc] Error 1
make: *** [all] Error 2


On Jan 18, 2007, at 11:59 AM, Ezra Zygmuntowicz wrote:

 Mini magick is very nice. But also look at ImageScience. If you are
 only using rmagick for thumbnailing, resizing and cropping then image
 science is much better. Its about 5 times faster and it doesn't leak
 any memory. Highly recommended.

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Re: [Mongrel] mongrel memory usage ballooning and process stomping

2007-01-19 Thread Hunter Hillegas
Yeah, I tried building it myself but got a similar compile error. I'm  
on Intel but I assume that it works with both arches.

I'll go back and check it again... The OS X instructions weren't  
working for me.

On Jan 19, 2007, at 7:33 AM, Michael D'Auria wrote:

 Hunter,

 I would just install it without using ports, you can check out the  
 image_science page for info on how to compile with specific Mac OSX  
 tips.


 On 1/18/07, Hunter Hillegas [EMAIL PROTECTED] wrote: I'm  
 interested in trying ImageScience but I can't get FreeImage, the
 processing lib, to build on MacOS X 10.4 (Intel). Has anyone had luck?

 I tried building from source and using DarwinPorts, both no dice:

 gonzo:~/Unix/Sources/imagescience_stuff/FreeImage hunter$ sudo port
 install freeimage
 ---  Building freeimage with target all
 Error: Target com.apple.build returned: shell command cd /opt/local/
 var/db/dports/build/
 _opt_local_var_db_dports_sources_rsync.rsync.darwinports.org_dpupdate_ 
 dp
 orts_graphics_freeimage/work/FreeImage  make all returned error 2
 Command output: Source/FreeImage/BitmapAccess.cpp:813: error:
 expected `;' before 'TAGMAP'
 Source/FreeImage/BitmapAccess.cpp:821: error: 'strcmp' was not
 declared in this scope
 Source/FreeImage/BitmapAccess.cpp:825: error: 'FreeImage_GetTagCount'
 was not declared in this scope
 Source/FreeImage/BitmapAccess.cpp:825: error: 'WORD' was not declared
 in this scope
 Source/FreeImage/BitmapAccess.cpp:825: error:
 'FreeImage_TagDataWidth' cannot be used as a function
 Source/FreeImage/BitmapAccess.cpp:825: error:
 'FreeImage_GetTagLength' was not declared in this scope
 Source/FreeImage/BitmapAccess.cpp:839: error: 'WORD' was not declared
 in this scope
 Source/FreeImage/BitmapAccess.cpp:858: error: 'TAGMAP' is not a class
 or namespace
 Source/FreeImage/BitmapAccess.cpp:858: error: 'iterator' was not
 declared in this scope
 Source/FreeImage/BitmapAccess.cpp:858: error: expected `;' before 'i'
 Source/FreeImage/BitmapAccess.cpp:859: error: 'i' was not declared in
 this scope
 Source/FreeImage/BitmapAccess.cpp:869: error: 'TAGMAP' is not a class
 or namespace
 Source/FreeImage/BitmapAccess.cpp:869: error: 'iterator' was not
 declared in this scope
 Source/FreeImage/BitmapAccess.cpp:869: error: expected `;' before 'i'
 Source/FreeImage/BitmapAccess.cpp:869: error: 'i' was not declared in
 this scope
 Source/FreeImage/BitmapAccess.cpp:874: error: type 'type error'
 argument given to 'delete', expected pointer
 Source/FreeImage/BitmapAccess.cpp: In function 'BOOL
 FreeImage_GetMetadata(FREE_IMAGE_MDMODEL, FIBITMAP*, const char*,
 FITAG**)':
 Source/FreeImage/BitmapAccess.cpp:887: error: 'TAGMAP' was not
 declared in this scope
 Source/FreeImage/BitmapAccess.cpp:887: error: 'tagmap' was not
 declared in this scope
 Source/FreeImage/BitmapAccess.cpp:891: error: 'METADATAMAP' was not
 declared in this scope
 Source/FreeImage/BitmapAccess.cpp:891: error: 'metadata' was not
 declared in this scope
 Source/FreeImage/BitmapAccess.cpp:891: error: 'struct
 FREEIMAGEHEADER' has no member named 'metadata'
 Source/FreeImage/BitmapAccess.cpp: In function 'unsigned int
 FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL, FIBITMAP*)':
 Source/FreeImage/BitmapAccess.cpp:912: error: 'TAGMAP' was not
 declared in this scope
 Source/FreeImage/BitmapAccess.cpp:912: error: 'tagmap' was not
 declared in this scope
 Source/FreeImage/BitmapAccess.cpp:915: error: 'METADATAMAP' was not
 declared in this scope
 Source/FreeImage/BitmapAccess.cpp:915: error: 'metadata' was not
 declared in this scope
 Source/FreeImage/BitmapAccess.cpp:915: error: 'struct
 FREEIMAGEHEADER' has no member named 'metadata'
 make[1]: *** [Source/FreeImage/BitmapAccess.o-ppc] Error 1
 make: *** [all] Error 2


 On Jan 18, 2007, at 11:59 AM, Ezra Zygmuntowicz wrote:

  Mini magick is very nice. But also look at ImageScience. If you are
  only using rmagick for thumbnailing, resizing and cropping then  
 image
  science is much better. Its about 5 times faster and it doesn't leak
  any memory. Highly recommended.

 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] mongrel memory usage ballooning and process stomping

2007-01-19 Thread Philippe Jayet
This is the fixed version ...

Philippe Jayet wrote:
 I've created a Debian package for ImageScience. It is not well tested 
 but works for me. If anyone is interested, I can upload it somewhere.

The package is for FreeImage, the ImageScience dependency !

Philippe J.
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] mongrel memory usage ballooning and process stomping

2007-01-18 Thread Ezra Zygmuntowicz
Hi~


On Jan 17, 2007, at 11:06 PM, Surendra Singhi wrote:

 Hi,

 First of all thanks everyone for their responses.

 On 1/18/07, Ezra Zygmuntowicz [EMAIL PROTECTED] 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.

 The output of 'ps aefux' is below. Though I don't understand ps  
 completely it seems that the one mongrel process spawns another  
 child process, which in turns spawns a third one.


Yes I have seen this before and it is nothing to worry about, even  
though it shows 9 mongrels you really only have 3 running.



 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.

 Yes, we are doing eager loading at many places, and there is a  
 sitemap part
 where about 10,000 records are loaded. I will try to optimize those  
 parts, and see
 if they make a difference.

This is one of your biggest problems right here. Its easy to return  
thousands of records from an AR query. But AR objects are expensive  
in terms of cpu and memory usage to construct. Working with 10,000  
records at once is a sure fire way to leak tons of memory and make  
your mongrels unstable.  Try to work with smaller sets of data.  I  
have yet to ever see a legitimate use case where you want to display  
10k records on one web page ;)

Use pagination or whatever you need to do to work with smaller sets  
of data. There is a paginating_find plugin that is useful and there  
is a gem called Paginator that I highly recommend over the stock  
rails paginator.


 A little more info about your app and what it does woudl  
 help debug.
 Are you using Rmagcik?

 Yes we are using that. I will look into mini-magick. Joey thanks  
 for that.


Mini magick is very nice. But also look at ImageScience. If you are  
only using rmagick for thumbnailing, resizing and cropping then image  
science is much better. Its about 5 times faster and it doesn't leak  
any memory. Highly recommended.


 Are you useing send_file or send_data to
 stream out large content?

 We are streaming data for images.

Is this a convenience or a requirement? This should be avoided if at  
all possible. The way rails works with mongrel is that mongrel will  
not send the finished request to the client until rails has  
completely finished. WHat I mean is when you use send_data or  
send_file with mongrel;, raiuls will try to stream the data in  
chunks. But mongrel will just buffer these chunks into a StringIO  
until rails is completely finished and then mongrel will send the  
entire thing to the client. This means that every time you stream  
data like this, the entire image has to be loaded into ram in mongrel  
before it will send it to the client.



 We are also using ferret and mediacloth.

I don't think these two are the cause of any of your leaks.


 I guess, I need to investigate more on the above mentioned things.
 Thanks a lot.

 Surendra Singhi




From what you have said the thing I worry about the most is loading  
10k AR objects into memory. That is not going to scale and will cause  
you no end of problems. Work with smaller sets. Switch to  
ImageScience if you can or at least to mini magick. If image Science  
will do everything you need to do then use it above all other options.

Hope that helps.

Cheers-
-- Ezra Zygmuntowicz 
-- Lead Rails Evangelist
-- [EMAIL PROTECTED]
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)


___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] mongrel memory usage ballooning and process stomping

2007-01-18 Thread Ezra Zygmuntowicz

On Jan 18, 2007, at 12:28 PM, Joey Geiger wrote:

 Is mongrel not releasing the memory used for these operations? I need
 to use send_file to stream some static images (4k max) (approved,
 declined, etc) which rails then turns into new cached images. This
 allows a group of people to get the current status of an item via html
 email with images. It's a neat hack, but I'd like to make it better.


For small 4k images that you cache after the first time they are  
streamed then I would not worry about it. Those should be fine. And  
mongrel+ruby does its bet to release memory used in this way. It's  
when you are constantly streaming data without caching it, that can  
cause slow memory buildups and the only way to reclaim the mem is to  
restart the mongrels. This is not entirely mongrels fault though.  
Ruby is pretty bad at releasing memory once it has it. Especially if  
you are swamping it so the GC can't keep up.

But 4k and cached I think should be fine. Are you experiencing leaks?



-- Ezra Zygmuntowicz 
-- Lead Rails Evangelist
-- [EMAIL PROTECTED]
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)


___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] mongrel memory usage ballooning and process stomping

2007-01-18 Thread Hunter Hillegas
I'm interested in trying ImageScience but I can't get FreeImage, the  
processing lib, to build on MacOS X 10.4 (Intel). Has anyone had luck?

I tried building from source and using DarwinPorts, both no dice:

gonzo:~/Unix/Sources/imagescience_stuff/FreeImage hunter$ sudo port  
install freeimage
---  Building freeimage with target all
Error: Target com.apple.build returned: shell command cd /opt/local/ 
var/db/dports/build/ 
_opt_local_var_db_dports_sources_rsync.rsync.darwinports.org_dpupdate_dp 
orts_graphics_freeimage/work/FreeImage  make all returned error 2
Command output: Source/FreeImage/BitmapAccess.cpp:813: error:  
expected `;' before 'TAGMAP'
Source/FreeImage/BitmapAccess.cpp:821: error: 'strcmp' was not  
declared in this scope
Source/FreeImage/BitmapAccess.cpp:825: error: 'FreeImage_GetTagCount'  
was not declared in this scope
Source/FreeImage/BitmapAccess.cpp:825: error: 'WORD' was not declared  
in this scope
Source/FreeImage/BitmapAccess.cpp:825: error:  
'FreeImage_TagDataWidth' cannot be used as a function
Source/FreeImage/BitmapAccess.cpp:825: error:  
'FreeImage_GetTagLength' was not declared in this scope
Source/FreeImage/BitmapAccess.cpp:839: error: 'WORD' was not declared  
in this scope
Source/FreeImage/BitmapAccess.cpp:858: error: 'TAGMAP' is not a class  
or namespace
Source/FreeImage/BitmapAccess.cpp:858: error: 'iterator' was not  
declared in this scope
Source/FreeImage/BitmapAccess.cpp:858: error: expected `;' before 'i'
Source/FreeImage/BitmapAccess.cpp:859: error: 'i' was not declared in  
this scope
Source/FreeImage/BitmapAccess.cpp:869: error: 'TAGMAP' is not a class  
or namespace
Source/FreeImage/BitmapAccess.cpp:869: error: 'iterator' was not  
declared in this scope
Source/FreeImage/BitmapAccess.cpp:869: error: expected `;' before 'i'
Source/FreeImage/BitmapAccess.cpp:869: error: 'i' was not declared in  
this scope
Source/FreeImage/BitmapAccess.cpp:874: error: type 'type error'  
argument given to 'delete', expected pointer
Source/FreeImage/BitmapAccess.cpp: In function 'BOOL  
FreeImage_GetMetadata(FREE_IMAGE_MDMODEL, FIBITMAP*, const char*,  
FITAG**)':
Source/FreeImage/BitmapAccess.cpp:887: error: 'TAGMAP' was not  
declared in this scope
Source/FreeImage/BitmapAccess.cpp:887: error: 'tagmap' was not  
declared in this scope
Source/FreeImage/BitmapAccess.cpp:891: error: 'METADATAMAP' was not  
declared in this scope
Source/FreeImage/BitmapAccess.cpp:891: error: 'metadata' was not  
declared in this scope
Source/FreeImage/BitmapAccess.cpp:891: error: 'struct  
FREEIMAGEHEADER' has no member named 'metadata'
Source/FreeImage/BitmapAccess.cpp: In function 'unsigned int  
FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL, FIBITMAP*)':
Source/FreeImage/BitmapAccess.cpp:912: error: 'TAGMAP' was not  
declared in this scope
Source/FreeImage/BitmapAccess.cpp:912: error: 'tagmap' was not  
declared in this scope
Source/FreeImage/BitmapAccess.cpp:915: error: 'METADATAMAP' was not  
declared in this scope
Source/FreeImage/BitmapAccess.cpp:915: error: 'metadata' was not  
declared in this scope
Source/FreeImage/BitmapAccess.cpp:915: error: 'struct  
FREEIMAGEHEADER' has no member named 'metadata'
make[1]: *** [Source/FreeImage/BitmapAccess.o-ppc] Error 1
make: *** [all] Error 2


On Jan 18, 2007, at 11:59 AM, Ezra Zygmuntowicz wrote:

 Mini magick is very nice. But also look at ImageScience. If you are
 only using rmagick for thumbnailing, resizing and cropping then image
 science is much better. Its about 5 times faster and it doesn't leak
 any memory. Highly recommended.

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] mongrel memory usage ballooning and process stomping

2007-01-17 Thread Michael Biven
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 [EMAIL PROTECTED] 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
[EMAIL PROTECTED]
http://biven.org
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] mongrel memory usage ballooning and process stomping

2007-01-17 Thread Joey Geiger
Is there anything you can do to force garbage collection in a case
like this? (loading in a few hundred records, or using send_file,
send_data?)

I already went through my application and removed RMagick (now using
mini-magick) but I'm still having monit restart a mongrel instance
every day (running 12, get maybe 2-4 restarts a day, even at odd times
like 2am, when there's little use on the site)

Any help apprecaited. Thanks.


 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?
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] mongrel memory usage ballooning and process stomping

2007-01-17 Thread Matthew Whittaker
I am seeing this same problem on my debian production server.  top  
shows the correct number of processes, but each mongrel instance and  
ruby running backgroundrb all are ballooning to 15% memory  
consumption within a day or two.  The application is http:// 
myfreecopyright.com

It may be in the code, but how do I troubleshoot this?

Cheers
-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 [EMAIL PROTECTED] 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
 [EMAIL PROTECTED]
 http://biven.org
 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

 -- Ezra Zygmuntowicz 
 -- Lead Rails Evangelist
 -- [EMAIL PROTECTED]
 -- Engine Yard, Serious Rails Hosting
 -- (866) 518-YARD (9273)


 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users


Re: [Mongrel] mongrel memory usage ballooning and process stomping

2007-01-17 Thread Surendra Singhi

Hi,

First of all thanks everyone for their responses.

On 1/18/07, Ezra Zygmuntowicz [EMAIL PROTECTED] 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.



The output of 'ps aefux' is below. Though I don't understand ps completely
it seems that the one mongrel process spawns another child process, which in
turns spawns a third one.


ssinghi  22988  0.7 11.3 142900 102572 ? S21:53   0:24
/usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -p 8000 -a
127.0.0.1 -P log/mon
ssinghi  22998  0.0 11.3 142900 102572 ? S21:54   0:00  \_
/usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -p 8000 -a
127.0.0.1 -P log
ssinghi  23000  0.0 11.3 142900 102572 ? S21:54   0:00  \_
/usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -p 8000 -a
127.0.0.1 -P
ssinghi  22991  0.9 12.0 131192 108844 ? S21:53   0:33
/usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -p 8001 -a
127.0.0.1 -P log/mon
ssinghi  22996  0.0 12.0 131192 108844 ? S21:54   0:00  \_
/usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -p 8001 -a
127.0.0.1 -P log
ssinghi  22997  0.0 12.0 131192 108844 ? S21:54   0:00  \_
/usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -p 8001 -a
127.0.0.1 -P
ssinghi  22994  0.5 10.1 127980 92160 ?  S21:53   0:18
/usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -p 8002 -a
127.0.0.1 -P log/mon
ssinghi  22999  0.0 10.1 127980 92160 ?  S21:54   0:00  \_
/usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -p 8002 -a
127.0.0.1 -P log
ssinghi  23001  0.0 10.1 127980 92160 ?  S21:54   0:00  \_
/usr/bin/ruby1.8 /usr/bin/mongrel_rails start -d -e production -p 8002 -a
127.0.0.1 -P



   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.



Yes, we are doing eager loading at many places, and there is a sitemap part
where about 10,000 records are loaded. I will try to optimize those parts,
and see
if they make a difference.

   A little more info about your app and what it does woudl help debug.

Are you using Rmagcik?



Yes we are using that. I will look into mini-magick. Joey thanks for that.

Are you useing send_file or send_data to

stream out large content?



We are streaming data for images.

We are also using ferret and mediacloth.

I guess, I need to investigate more on the above mentioned things.
Thanks a lot.

Surendra Singhi



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 [EMAIL PROTECTED] 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
 [EMAIL PROTECTED]
 http://biven.org
 ___
 Mongrel-users mailing list
 Mongrel-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/mongrel-users

-- Ezra Zygmuntowicz
-- Lead Rails Evangelist
-- [EMAIL PROTECTED]
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)


___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users





--
Surendra Singhi
http://ssinghi.kreeti.com, http://www.kreeti.com
___
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users