Help with Apache and Production

I have my Rails app in an Apache server. If i don't use this app for a while it goes very slow the first clic. After this first clic, it goes very fast. I want the first response to be fast too. My production.rb file is:

# Settings specified here will take precedence over those in config/environment.rb

# In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.cache_classes = false

# Log error messages when you accidentally call methods on nil. config.whiny_nils = true

# Show full error reports and disable caching config.action_controller.consider_all_requests_local = true config.action_view.debug_rjs = true config.action_controller.perform_caching = false config.action_view.cache_template_extensions = false

# Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = true

# set delivery method to :smtp, :sendmail or :test config.action_mailer.delivery_method = :activerecord

# these options are only needed if you choose smtp delivery config.action_mailer.smtp_settings = {   :address => "...",   :port => 25,   :domain => '...',   :authentication => :login,   :user_name => "...",   :password => '...' }

If you're using fastcgi then it's probably your fastcgi listeners getting killed off. You can probably tweak this in your apache config but it's been so long since i've used fastcgi that I don't recall how.


Any idea?

For me, I have the following in my apache's httpd.conf file:

# FastCGI <IfModule mod_fastcgi.c>   FastCgiIpcDir /tmp/fcgi_ipc   FastCgiConfig -initial-env RAILS_ENV=production   FastCgiServer /home/client/current/public/dispatch.fcgi -initial-env RAILS_ENV=production -processes 1 -idle-timeout 60   FastCgiServer /home/client2/current/public/dispatch.fcgi -initial- env RAILS_ENV=production -processes 2 -idle-timeout 60   FastCgiServer /home/client3/clientapp/public/dispatch.fcgi -initial- env RAILS_ENV=production -processes 2 -idle-timeout 60 </IfModule>

This makes 'em permanent processes.