Is it normal for mongrel to never release memory?
We just started using NewRelic for performance monitoring (it's
awesome btw). It has given us a lot of insight into how our
application is running.
One thing we've noticed is memory usage. Our mongrels normally take up
about 118MB of memory. Sometimes the memory usage increases
dramatically. We've determined that the increases in memory usage
occurs when specific reports are run. When these specific reports are
run the memory usage will increase to over 1GB.
My question is this; after these reports (actions) are finished, the
memory is never released. The mongrel continues to hold over 1GB of
memory, even though the large request is over and done. I first
thought there was a problem in our actions and we needed to do
something to fix it to release the memory. Since then I've noticed
that when any of the mongrels increase their memory usage (even a
little bit) the memory usage NEVER goes down. We have to restart the
mongrels for it to release the memory.
Is this normal? Is mongrel just greedy? Does it never release memory
once it's allocated? Or is this a sign that something is not right in
my app?
awesome btw). It has given us a lot of insight into how our
application is running.
One thing we've noticed is memory usage. Our mongrels normally take up
about 118MB of memory. Sometimes the memory usage increases
dramatically. We've determined that the increases in memory usage
occurs when specific reports are run. When these specific reports are
run the memory usage will increase to over 1GB.
My question is this; after these reports (actions) are finished, the
memory is never released. The mongrel continues to hold over 1GB of
memory, even though the large request is over and done. I first
thought there was a problem in our actions and we needed to do
something to fix it to release the memory. Since then I've noticed
that when any of the mongrels increase their memory usage (even a
little bit) the memory usage NEVER goes down. We have to restart the
mongrels for it to release the memory.
Is this normal? Is mongrel just greedy? Does it never release memory
once it's allocated? Or is this a sign that something is not right in
my app?
2
people have this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?No, the memory allocated to any Ruby process will never go down. This isn't a mongrel or Rails thing. In fact it's probably true of any process.
It sounds like you have a page that allocates a massive amount of temporary objects. Your best option is to tune your application to try to reduce the amount of overhead. While RPM can't show you object allocations it can show you details of your interaction with the database and where time is being spent. Look for the code where the most time is being spent and see if you have excessive use of buffers or inefficient String operations. Beware of having many many small Active Record objects.
Do you have a memory leak? Here's how to tell. Hit the page that causes the memory to jump up. Then hit it repeatedly. Is there only a bump the first time, or does it get bigger with each hit? The latter would indicate a memory leak.
Hope this helps. -
Inappropriate?Hi Mike,
If it's any consolation the same thing happens to us and many of the apps we manage. The big question is what the magnitude of the leak is. We see very slow leaking once a mongrel "warms up" and have put our mongrels on a 4 hour restart cycle. We were concerned that our agent was causing the leak but after repeated stress testing with/without our agent we saw the same behavior.
- Jim
Loading Profile...



EMPLOYEE
EMPLOYEE