[Mongrel] mongrel memory usage ballooning and process stomping
jgeiger at gmail.com
Thu Jan 18 17:14:43 EST 2007
Zed: Sorry not blaming you and your app. I guess that came across
wrong. Without mongrel right now, I'd be somewhat screwed from an ease
of use standpoint.
Right now, my hands are fairly tied with the use of x-sendfile and
headers since I'm actually double proxying my application (Apache 1.3
-> nginx(localhost:8000) -> mongrel_cluster(localhost:8001-4)). Nginx
serves any static images that rails creates back to apache. (Anyone
know how to get ProxyPass ! /images/ to work on 1.3? :)
I do believe that it is my app that's having issues, but it's not to
the point where it's threatening the stability of my system. I have
monit watching the mongrels, so they will restart when they use too
The flowchart for part of it is something like this:
user submits a comment (comment id 5)
system notifies 5 editors via html email that there is a new comment
inside the email, there is an <img src="status_image/5" /> showing the status
editor1 views the email
the controller does a send_file("images/pending.png") and caches it as
editor1 sees the status as pending and moves to another email
editor2 views the email, sees the status as pending and approves the comment
controller removes the cached image (/status_image/5.png)
editor3 now views the email
the controller does a send_file("images/approved.png") and caches it
editor3 now sees the comment has been approved and moves on
editor1 comes back to view the comment and now sees that it has been
approved and moves on
While I'm caching the images, the application has to do this a bunch
of times, and re-do it each time the status of the item is changed, so
each of the editors sees the freshest status. So it's not a big hit
and restart every time, but I think over the course of a few days, it
builds up, and the process is restarted.
I'm learning this day by day as I go on, so I'm always open to suggestions.
On 1/18/07, Ezra Zygmuntowicz <ezmobius at gmail.com> wrote:
> 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
> -- ez at engineyard.com
> -- Engine Yard, Serious Rails Hosting
> -- (866) 518-YARD (9273)
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
More information about the Mongrel-users