views:

152

answers:

4

Hi there,

We're running 3 Apache Passenger servers sharing the same file system, each running 11 Rails applications.

We've set

  1. PassengerPoolIdleTime = 0 to ensure none of the applications ever die out completely, and

  2. PassengerMaxPoolSize = 20 to ensure we have enough processes to run all the applications.

The problem is that when I run passenger-memory-stats on one of the servers I see 210 VM's!

And when I run passenger-status I see 20 application instances (as expected)!

Anyone know what's going on? How do I figure out which of those 210 instances are still being used, and how do I kill those on a regular basis? Would PassengerMaxInstancesPerApp do anything to reduce those seemingly orphaned instances?

A: 

Not so much an answer, but some useful diagnostic advice.

Try adding the Rack::ProcTitle middleware to your stack. We have been using it in production for years. Running ps aux should give info on what the worker is up to (idle, handing a specific request etc…).

I would not assume that these processes are being spawned directly by passenger. It could be something forking deeper into your app.

cwninja
Hmm...good thought, but I can't imagine our 11 applications needing an extra hundred worker processes, and they are all reported to have between 163MB and 165MB VMSize and b/w 10 and 40 resident sizes.My only other guess is that if Passenger needs to start another instance for the heavy load applications (2 of the applications undergo much heavier load), then it boots one of the less used apps and keeps it around, BUT never uses it again...is that passible?
btelles
+1  A: 

You can get a definitive answer as to how many Rails processes you have by running this command:

ps auxw | grep Rails | wc -l

I doubt you really do have over 100 processes running though, as at about 50 mb each they'd collectively be consuming over 5 gb of RAM and/or swap and your system would likely have slowed to a crawl.

npad
Heh...sounds like the 5gb of ram and slowing to a crawl is likely, as we have 32g of ram for 11 measly apps...sounds like our IT department should be converted to a marketing department if ya ask me.I'll test it out.
btelles
oh, by the way, we're on Solaris, and I think one of the options in ps aux aren't vaild in Solaris...I'll check it out though.
btelles
:marketing comment implies that although we can't use our stuff, we sure can influence people to buy stuff. :-/
btelles
A: 

Maybe the processes are stuck during shutdown. Try obtaining their backtraces to see what they're doing.

Hongli
A: 

Turns out we actually have that many Apache worker processes running, and only 24 of them are Passenger processes (asked someone a little more experienced than myself). We are actually hosting many more websites and shared hosting accounts than I thought. Thanks for all the replies though!

btelles