FastCGI - Slow response time for initial request?


Can anyone provide any advice onto how to resolve or work-around a large response-time delay I get for the 1st time I hit a page on my Dreamhost hosted (shared environmnet) Ruby On Rails site?

I’ve put some logging in the " dispatch.fcgi" code and note the following:

  • HTTP log output for initial request:
  • “dispatch.fcgi” entry: 1 second after this
  • fastcgi process log entry: 24 seconds after last step
  • my RoR app log entry: 1 second after last step
    ==> THAT IS, it seems to be the delay for the fastcgi process to start off!

I’m interested in any advice on how to tackle this issue on either of the two below options:

(a) assuming the root cause is that my fastcgi/ruby processes seem to get killed off after some timeframe - i.e. when I hit my application the next day the response time for the first request is very slow (after which 2-3 fastcgi/ruby processes seem to get kicked off) => IS THERE A WORK AROUND FOR THIS?

(b) when the fastcgi/ruby processes do start up, they seem to take a long time to start. In other words the slow response time for that first request seems to be due to the fastcgi startup => IS THERE A WAY TO IMPROVE THIS? IS SUCH A LONG START UP TIME EXPECTED?

Do other Ruby on Rails application developers using shared Dreamhost hosting have the same problem?