I probably shouldn't, but I'm getting kicks out of making sites load tenths of a second faster. *
The night of writing this post, I stumbled across mod_pagespeed from Google and instantly started tweeting some interesting things about it. Moments later, I'd installed it on this server and started comparing the load times... But before we go any further let me give you a very quick introduction.
What is mod_pagespeed?
If you hadn't already guessed, it's an Apache module, and a good one at that. Three small installation steps with no configuration and you will instantly see performance benefits! A bold statement (that I did extract from the below video) but it's doing some very clever things under the hood.
The whole idea is that all your usual optimisation: compression, concatenation and minifying is done for you (plus a lot more). Things you don't need to do after installing mod_pagespeed:
- Change how you generate your content
- Change your CSS/JS/HTML or other markup
- Run your own manual compression or build steps
This video covers it's functionality in much further detail.
First SSH into your server and download the module's package file. I'm using the Ubuntu 32bit version. (View the docs for further installation instructions for CentOS/Fedora and package URL's for 64bit packages.)
Then run these next two commands to complete the install.
dpkg -i mod-pagespeed-*.deb apt-get -f install
And... your done!
Check that it's installed correctly
To do this you can run a simple curl command to check to see if the pagespeed headers are present.
curl -D- http://example.com | less
You should see the following somewhere near the top of that result.
Next, a head to head. Head over to Which Loads Faster? and put your URL in the left hand side and in the right but followed by "?ModPagespeed=off". This will give you a test between how fast your site loads with and without pagespeed. You should see some improvement, even if your sites already heavily optimised. If you don't it may be time to start playing with some of the filters available to you.
I did experience one issue with mod_pagespeed and WordPress in the admin area, but this can be resolved by adding the following line to your .htaccess file or virtual host config.
Did it work for you?
Please let me know if this helped you out or any particularly good filters that are working for you!
* I definitely should be