Joomla and PageSpeed

A while back I installed the PageSpeed module for Apache in an effort to improve my sites performance. How much of an affect it has is debatable but the site scores more highly on the Google PageSpeed score which is a good thing since now it won’t suffer a listing penalty for being slow.

As with all these great ideas though there’s upsides and there’s downsides. The PageSpeed module is mostly just a cache of the resources the site uses. It doesn’t some other “clever” optimizations as well though and it was one of these that caught me out.

After upgrading Jooma on a demo site to 3.1.4 I found that my toolbars were missing unless I expanded the editing area so that it was larger than the window (or shrank the window of course). It seemed the appearance of scrollbars triggered something that showed the menu. I had a look in the release notes for Joomla 3.1.4 and, to my surprise, there was a direction to clear the browser cache to get the new stylesheets and scripts which would correctly display the menus. I was surprised because I never seem to have a problem that is listed, naturally.

I dutifully cleared my browser cache and… nothing. Still no menus. After digging for several hours I was eventually pointed in the direction of PageSpeed. It turns out that one of the things PageSpeed does is combine CSS and JavaScript files. That makes it difficult for it’s cache to determine when they change it would seem (either that or the algorithm is dumb as a brick).  It didn’t matter how many times I cleared my browser cache PageSpeed was always delivering the old version of the files.

So, if you want to use PageSpeed with Joomla you’d best know the magic incantation to flush the PageSpeed cache. Simply shell into your server and execute the following command:

sudo touch /var/cache/mod_pagespeed/cache.flush