I’ve been wondering for a while why Phusion Passenger seems to completely ignore the PassengerMaxPoolSize, PassengerMaxInstancesPerApp and PassengerPoolIdleTime directives. I recently discovered that they don’t work inside VirtualHost blocks in apache config. The old (non-working) config was something like :


<VirtualHost *:8080>
    ServerName recurser.com
    ServerAlias www.recurser.com

    DocumentRoot /var/www/recurser.com
    # My rails app is served from the /code/ subfolder of my main domain
    RailsBaseURI /code
    PassengerMaxPoolSize 3
    PassengerMaxInstancesPerApp 2
    PassengerPoolIdleTime 120
    # I use Ruby Enterprise Edition (http://www.rubyenterpriseedition.com/)
    # You can remove the following line if you use regular ruby
    PassengerRuby /opt/ruby-enterprise-1.8.6-20080810/bin/ruby
    ...
    ...
</VirtualHost>

When i moved the directives outside the VirtualHost block, everything worked as advertised :

PassengerMaxPoolSize 3
PassengerMaxInstancesPerApp 2
PassengerPoolIdleTime 120
* I use Ruby Enterprise Edition (http://www.rubyenterpriseedition.com/)
* You can remove the following line if you use regular ruby
PassengerRuby /opt/ruby-enterprise-1.8.6-20080810/bin/ruby

<VirtualHost *:8080>
    ServerName recurser.com
    ServerAlias www.recurser.com

    DocumentRoot /var/www/recurser.com
    # My rails app is served from the /code/ subfolder of my main domain
    RailsBaseURI /code
    ...
    ...
</VirtualHost>

You can check what passenger is doing by looking inside the /tmp/passenger_status.* file on your system (the filename will vary depending on your system). :

----------- General information -----------
max      = 3
count    = 1
active   = 0
inactive = 1

----------- Applications -----------
/var/www/code.recurser.com:
  PID: 14494     Sessions: 0