|
I'm having a problem with my custom NGINX install and the single ruby on rails app I'm hosting with it. At certain times it seems to take up almost twice my available RAM/Memory and then the process gets terminated which shuts the site down. Is there anything I can do to reduce it's memory consumption? I checked and it's running in the production environment so it's at least not that simple. I'm really stumped and my client is getting upset and I'm just not sure how to fix this. |
|
We need some more info to be able to assist you. Typically nginx/passenger/ruby apps do not occupy that much memory. However like any dynamic application it is subject to change, and it greatly depends on what logic your site is processing, how much traffic, and various other variables. One thing we would need to know is exactly how much RAM does your application use? Does this use stay steady most of the time? How long/gradually does it take for the memory to increase, does it normally stay low and than happen in 1 large 'spike' or is it a gradual buildup of RAM over time/requests? You can see how much RAM you are using in MBs with this command (replace 'user' with your username),
And you can see total processes with RAM use in bytes with this command,
We have a memory monitor script here that can be set up in conjunction with crontab to give you status over time,
Once you know what the memory 'leak' looks like you can than try to determine why. By comparing the stats to your request logs you should be able to see what the site was doing at that time and possibly reproduce the issue. Once you have isolated the 'leak' you can debug that part of your code. |