The main page of this site is now a Rails app, and I plan to use Rails more extensively as time goes on. I run Passenger with Apache, which is a pretty nice solution. (I’m thinking of dropping in REE in lieu of standard Ruby, too?)
But it had one crippling bug: if you were the first to hit the page in a while, it was unbearably slow. It turns out that my guess about what was happening was correct: after a period of inactivity, your app will spin down to free up memory for other threads. The benefit is that it’s proper and efficient. The downside is that if someone hits the application (here, “the application” is the main page) for the first time in a while, Passenger has to load the application into memory again. And as someone who works with Rails on a daily basis, I have to say that it’s excruciatingly slow to start. 10-30 seconds is the norm for me.
The fix is apparently pretty easy: set PassengerPoolIdleTime much higher to leave idle threads running longer, or set it to 0 to leave them running forever “unless it’s really necessary” to make room for something else. The documentation also notes, “Setting the value to 0 is recommended if you’re on a non-shared host that’s only running a few applications, each which must be available at all times.”
You’ll probably also want to set RailsFrameworkSpawnerIdleTime and RailsAppSpawnerIdleTime to 0 if you go that route.
Drop the settings right into httpd.conf, restart Apache, and viola.