Reputation: 12214
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.
Upvotes: 1
Views: 491
Reputation: 136
If you can not use NewRelic or don't have the money for the pro plan you can try following to pinpoint problems with passenger:
sudo /usr/local/bin/passenger-status
to view which and how many processes belong to which site - very usefull if serving several sites from one machine and
sudo /usr/local/bin/passenger-memory-stats
to view detailed memory information for all processes involved in serving (apache + passenger + ruby).
One could also setup a traditional monitoring as with munin. There are several howtos for monitoring passenger with munin
Upvotes: 1
Reputation: 586
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
Upvotes: 1