1

I've followed the instructions outlined in this answer to prevent Passenger from shutting down my app after not being used for a few minutes. However, none of this has worked.

If I refresh my website (which is just served locally on my Mac on Apache) after about 1 minute, it takes it about 6 seconds to load. After that long load, the site is now fast and everything is good. If I let it sit for another minute, refreshing again takes another 6 seconds.

Here is my /etc/apache2/other/Passenger.conf file:

LoadModule passenger_module /Users/maq/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.14/buildout/apache2/mod_passenger.so
PassengerRoot /Users/maq/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.14
PassengerDefaultRuby /Users/maq/.rvm/wrappers/ruby-2.0.0-p247/ruby

PassengerSpawnMethod smart
PassengerPoolIdleTime 1000
RailsAppSpawnerIdleTime 0
PassengerMaxRequests 5000

PassengerMaxPoolSize 30
PassengerMinInstances 1
PassengerEnabled on

And I have restarted Apache after changing all these settings.

Any ideas what else it could be?

Update:

I tried going the cron job route, where I run a cron job every minute to access the web page and make sure it stays alive. Interestingly enough, this does not work either.

It accesses the web page properly, and I see in my logs that the page is being accessed every minute, however every time I try to access it in the browser after a minute or so of user-generated activity, there is that 6 second load up. What can this be?

Note: I am using Rails 4.0.

Community
  • 1
  • 1
Snowman
  • 31,411
  • 46
  • 180
  • 303
  • How does the output of `passenger-status` look like immediately after you access the site? And after 1 minute? – Hongli Sep 04 '13 at 22:39
  • @Hongli they look exactly the same. Max pool size: 6, Processes: 4, Requests in top-level queue : 0 – Snowman Sep 05 '13 at 22:22

1 Answers1

0

It turns out the cause of my issues was not Passenger, but Apache and DNS.

It's a Mac OSX issue, and you can find out more about the problem/solution here: http://clauswitt.com/fixing-slow-dns-queries-in-os-x-lion.html

Basically, if you have an entry in your /etc/hosts file called:

127.0.0.1 railsapp.local

you need to add its IPv6 counterpart so that the system doesn't go performing a remote DNS query:

fe80::1%lo0 railsapp.local
Snowman
  • 31,411
  • 46
  • 180
  • 303