My application is swapping to disk, because it is using 2.2 GB of memory. I can’t figure out what in my application is causing it to be such a memory hog.
This is an RHEL5 VM, with 2 GB of RAM.
Rails is version 3.1.3.
My webserver in nginx v1.0.10, using Phusion Passenger version 3.0.11.
The “ruby” process appears to be completely off the hook in terms of its memory footprint.
The application is a relatively straightforward product catalog. The server is crashing about twice per day when it runs out of memory. I’m also using memcached v1.4.4.
Rails caching is causing the crash when it is eventually unable to establish any more memory.
I don’t know what steps to take to determine why my application has such a large footprint.
Could it be:
1) Some gems being loaded into memory?
2) A faulty or insufficient Passenger setup in my nginx.conf file?
3) Something else?
I deeply appreciate any help anyone can offer! I am having to check this thing every two hours at night. Not fun!
UPDATE:
Passenger config is as follows:
server {
listen 80;
client_max_body_size 4M;
server_name www.myapp.net myapp.net *.myapp.net;
root /usr/code/mcp5/public; # <--- be sure to point to 'public'!
passenger_enabled on;
passenger_min_instances 5;
rails_env production;
rails_framework_spawner_idle_time 0;
rails_app_spawner_idle_time 0;
}
I also noticed in my logging utility that this thing is quickly spinning up to over 20 ruby procs.
What does your passenger configuration look like? You may have too many threads for the resources available to you.
Thanks for the update.
Although our servers have much more resources than yours, we still make use of the following directive.
Try setting it to 10 to start off with and perform your load test. This should at least stop the app from killing your server. I would then spend further time trying to determine where the bottleneck is. We use Newrelic for performance monitoring.hope this helps