A Quick Speed Boost

We recently moved some of our processing from Engine Yard over to Contegix. The initial results are really positive – big boosts in our processing power and capacity. Part of the conversion, of course, is getting brand new servers setup (or as my coworker Justin calls it “Christmas Morning”).

There are lots of great stories to tell about what we’re creating and how we’re doing it but after reading an old coworkers post recently, I thought I’d share a few quick hitters that (can) provide significant performance boosts.

make stuff small.

As Shmueli eludes to: mod_deflate (previously mod_gzip) can really help out – most browsers can handle it these days and even with today’s connection speeds – smaller amounts of data == good. Our exclude list has a tad more to it than his example, but this tutorial has the basics.

don’t keep asking “is this old?”

Add an expires header (where possible). If you’re using Rails (a large percentage of our stuff does), it’s helper methods like to add 10 digit query strings to the end of static resources. Things like this:

<script src=”/javascripts/application.js?1200895515″ type=”text/javascript”></script>

There are several approaches you can find out there that can leverage that to really speed things up. I ended up with something along these lines. It does require a symlink that gets wiped out by our Capistrano deploy (so it needs to recreate it for me each time), but… I like it – and it’s been working great. It’s amazing how much faster and lighter things are when you let the browser use it’s cache a bit and not make so many needless requests.

more…

I had more trouble than good with e-tags…

I decided against minifying the js – I think the added complexity of the process (making sure things are minified each time, the app points at the right stuff, etc) outweighs the benefit of a slightly smaller transmission, in our case.

We also don’t really have pages heavy enough with images to make sprites a worthwhile endeavor at this point — This was actually a disappointment to me. I haven’t had a chance to implement sprites yet and would really like to give them a real-world try at some point…

and mostly…

There are likely a bunch of other quick hitters worth implementing (I’d love to see some listed in the comments), but in the end – as always – the most important thing is just to be smart with your app. No amount of tweaks (big or small) can overcome bad decisions in the overall implementation.

Advertisements

1 Comment

Filed under performance

One response to “A Quick Speed Boost

  1. Mod_deflate in apache2 is pretty much the same as mod_gzip in apache1.3, and mod_deflate is included with the apache2 source package. Both modules allow compressing of the apache server on the fly

    http://railsgeek.com/2008/12/16/apache2-httpd-improving-performance-mod_deflate-gzip

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s