I have just put into production one of my Ruby On Rails Application and noticed it was really slow in its loading time.
My Application runs on railsplayground.net using passenger on an apache server.
I took a look at a couple of sites including: pingdom , webpagetest
and the major downfall I had noticed in my application is that the caching isn’t working on my javascript and css files as can be seen here:



I have tried reading all sorts of guides on how to cache, but all of my efforts turned up with no results.
I put this in my header file:
<meta http-equiv="cache-control" content="public" />
<meta http-equiv="last-modified" content="Sun, 23 Sep 2012 08:00:00 GMT" />
and this is turned on in my production.rb:
config.action_controller.perform_caching = true
What these items are complaining about is that the when you are serving static assets (images, css, javascript) the webserver isn’t telling the browser that they are cacheable so they will be refetched more often than necessary.
When using the asset pipeline (as you seem to be) the asset filename includes an md5 checksum of its content so you can set very long expiry times: if you change the file then the checksum will change to and so the file browsers requests will have a different name.
You usually do this in apache’s configuration, by sticking something like this in the block for the virtual host
It’s also worth turning on gzipping of javascript & css files which can save a lot of time. You’d do this by adding something like this to the virtual host:
Older browsers may not support this, but this is so widely supported that I turn this on systematically (to give you an idea, even IE 4 and Netscape Navigator 4 support this)