Google’s mod_pagespeed

We’ve been running mod_pagespeed for a few weeks now. The results appear to be very positive in our tests. However, Google Analytics hasn’t shown any conclusive improvement in performance. When we compare mod_pagespeed against bare apache, page load times improve by around 1 second, but GA shows erratic results.

I think our traffic is too low for GA to get consistent results. We have set the page speed sample to the maximum 10%, but even then we’re not getting enough data to provide an accurate picture. That’s my guess. We’re running boomerang on all page loads, however, we’re still working on how to analyse the data to get useful statistics from it.

The stock mod_pagespeed install leaves out a couple of big improvements that are low risk. We tweaked the config by enabling the following filters:

ModPagespeedEnableFilters combine_javascript,remove_comments,collapse_whitespace,outline_javascript

We don’t have any data, but my feeling is that enabling the collapse_whitespace and remove_comments made a big difference. It reduced our HTML page size considerably, although the effect was offset by the inlining of smaller images. We also enabled the ModPagespeedLoadFromFile option to load our static assets directly from disk. Not sure how much difference it makes in practice, but it seemed like a low risk, sensible option.

We also used the ModPagespeedMapRewriteDomain and ModPagespeedShardDomain options to rewrite static requests onto a CDN. More about that in a later post.

Sysadmin friendly

The biggest advantage of mod_pagespeed from my perspective as the sysadmin was that it required zero changes to the application. That was a big win for us because it meant no code changes and no developer time. For example being able to combine, minify and CDN enable all our static assets with a couple of changes to the apache vhost config without a single code change was superb.

At first I thought mod_pagespeed had increased our time to first byte by around 200ms, but that turned out to be a myth. It’s hard to tell exactly, but it looks like it adds maybe 20ms to our time to first byte. That’s a very reasonable trade off for the advantages.

Conclusion

From a sysadmin perspective, mod_pagespeed is great. It applies across all the pieces of our application (we had to disable it for some with ModPagespeedDisallow). If I have time I’ll look into writing our own custom filters to insert things like boomerang, but that’s a longer term nice-to-have, not a core requirement.

Bottom line, after my initial scepticism, I can recommend mod_pagespeed if you want to easily reduce your roundtrips and CDNify your static assets at the server level rather than the application level. Big thanks to the mod_pagespeed developers who appear to be ultra responsive on the mailing list.

Advertisements