Reducing Heap Fragmentation - Any Thoughts?

My mongrels slowly grow as my application runs, and I have to restart
them every few days (not as bad as some, I know). I used bleak_house
and had the following conversation with Evan:

http://rubyforge.org/forum/forum.php?thread_id=24104&forum_id=13983

Essentially, it looks like I have no leaks, but Evan suggested that I
may be suffering from heap fragmentation. I have found a theoretical
method to overcome this here…

http://www.brpreiss.com/books/opus8/html/page428.html

…but am not sure how it can be implemented.

Does anybody have any suggestions or experience dealing with
overcoming heap fragmentation? Perhaps something else could be
causing the memory growth that I should look into? I’m glad that my
app doesn’t have memory leaks, but I’m not sure what to do to keep the
mongrels from steadily growing until I run out of RAM…

Thanks!

-Kyle

Does anybody think that Passenger/mod_rails might help? I’d just give
it a try, but the app is already in production, and I’d hate to
reconfigure it and take it down for nothing…

-Kyle

Kyle wrote the following on 07.05.2008 19:32 :

http://www.brpreiss.com/books/opus8/html/page428.html

…but am not sure how it can be implemented.

Does anybody have any suggestions or experience dealing with
overcoming heap fragmentation? Perhaps something else could be
causing the memory growth that I should look into? I’m glad that my
app doesn’t have memory leaks, but I’m not sure what to do to keep the
mongrels from steadily growing until I run out of RAM…

Some ideas :

I use seesaw (http://rubyforge.org/projects/rails-oceania) to restart
mongrels without impacting the users. I don’t use it for saving memory
(although at a point I did) but to restart mongrels after log rotation.

I had some pages that accessed a lot of ActiveRecord objects and used
too much memory, I rewrote some code to get at the info I needed without
creating as much model instances, it helped a lot.

One of the selling points of Jruby for me is that it is supposed to use
less memory than MRI. You might want to test it.

I don’t think passenger will save you much. It removes a lot of memory
usage associated with the initial Rails and Ruby loading but not with
the actual “run” where your problem is. They have a tuned MRI in the
works that would certainly help there tough.

Lionel

Thank you for the suggestions! I’ll work on my code and check out
Jruby.

-Kyle

On May 12, 7:53 am, Lionel B. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs