Photo-1 Photo-2 Photo-3 Photo-4 Photo-5 Photo-6



Full-time web developer. Part-time smart ass.

I'm Brent Collier.

After a year and a half as an engineer on Twitter's Trust & Safety team, I'm looking for my next gig. Contact me if you know of something interesting.


Kicking Assets and Taking Names

Posted on 11/01/2011

There's a couple of simple things you can do to really make your Rails 3.1 app more responsive...

  1. Precompile your assets in your production environment. I think this pretty much goes without saying, but if for some reason you're not doing this, then you should be.
  2. If you are precompiling your assets, make sure you turn on digests. Digests are the long alphanumeric strings that you'll sometime see appended to the end of an asset url. They intelligently cache your static assets since the digest will change if the asset is changed. Digests are turned on by default in the production environment, but if you have a staging environment, you may need to explicitly enable them.
  3. Also, precompiling your assets is pointless if your web server isn't serving them up. With the default Passenger configuration, Apache will serve up static assets without a problem, but if your're running on Nginx it may not work out of the box. Recompiling Nginx with the gzip_static module may be necessary.

Doing these three things should dramatically reduce page load times and give your app a much snappier feel.