Search code examples
ruby-on-railsrubydeploymentcachingcapistrano

"Warm Up Cache" on deployment


I am wondering if anyone has any plugins or capistrano recipes that will "pre-heat" the page cache for a rails app by building all of the page cached html at the time the deployment is made, or locally before deployment happens.

I have some mostly static sites that do not change much, and would run faster if the html was already written, instead of requiring one visitor to hit the site.

Rather than create this myself (seems easy but it lowwwww priority) does it already exist?


Solution

  • I have set integration tests that confirm all of the main areas of the site are available (a few hundred pages in total). They don't do anything that changes data - just pull back the pages and forms.

    I don't currently run them when I deploy my production instance, but now you mention it - it may actually be a good idea.

    Another alternative would be to pull every page that appears in your sitemap (if you have one, which you probably should). It should be really easy to write a gem / rake script that does that.