Caching and Compression Guide by Andy Miller

Caching and Compression Guide by Andy Miller

Posted 8 years 10 months ago

Caching and Compression

Joomla

* Global Config - GZip Compression : This setting tells the webserver (typically Apache) to use gzip compression when sending the main HTML output that Joomla generates. This can reduce the size of the file quite dramatically. On the order of 70-90%. The main benefit of this is that the time it takes to send the file to the browser is greatly reduced, however the trade off is the webserver has to do more work in order to compress the file. Usually the tradeoff is worth it and we recommend enabling GZip compression on all sites.

* Global Config - Cache Settings : This setting is the global toggle to enable caching for Joomla. Every extension looks to this setting to see if they should cache their output. During development this can cause some strange lingering effects as updating an article will automatically flush the com_content cache, but it's not smart enough to know that a module might of had part of this same article cached. In these cases after you edit an article you should also manually flush the cache via the "clean cache" setting in Tools. Cache is the primary method to increase performance, so we highly recommend enabling this and setting it to 30-45 minutes when you are running in a 'live' environment. It's less handy during development, so we generally don't enable cache until we're ready for business.

* Plugin Manager - System-Cache : When you have enabled the Global config cache setting, you have the option to enable the System-Cache plugin. This cache plugin performs a 'page-cache' which can potentially have a huge performance boost, however due to it's nature, it's very rarely a viable option. What this plugin does is take the rendered Joomla output and store it in it's entirety in the cache. The next user to visit the page, get's shown the exact same output as the user before. This limits the amount of per-user customization that can be done, and you could potentially show data to a user that should not see it. In Gantry we send specific CSS files to IE users and don't send those files to other browsers. This is a performance optimization to ensure that only the files you need are sent, however a page cache breaks this as it will send you the same files no matter what your browser. Also if you have any 'dynamic' data displayed, that will be cached, and not updated. Overall, unless you have a very static site, this is not useful, and with Gantry it's not practical at all. We recommend not using this cache option.

Gantry

* Template Details - Gantry Cache : Gantry is a very powerful and highly flexible framework. As such there are lots of configuration options and information regarding features, overrides, etc. In order to help with performance the Gantry Cache stores some of this data in a format that negates the need to re-parse the configuration details on every load. It also stores data about currently published modules and other Joomla related data. The cache is flushed every time you 'save' or 'apply' in the template details so it's pretty safe to enable this setting at all times. If you ever make a change to a file, and find it's not being reflected in the template, you can just re-save the template parameters and it will flush the cache, and show your reflected change. This setting can increase performance dramatically, however we generally don't enable it ourselves during the early phases of development, but when we are getting closer to a final template release, we enable it and certainly have it enabled on any live site.

* Template Details - Gantry GZipper : The Joomla Global Config "GZip" option is helpful, but it only compresses the main HTML output that Joomla generates. The Gantry GZipper feature is really a lite version of the RokGZipper plugin. The Gantry GZipper option extends on this by helping out with CSS and JavaScript files controlled by Gantry. Basically it combines any files it can into the minimal amount of files possible to reduce HTTP requests, and then it toggles the headers in order for the webserver to send these files in a GZip compresses format. Because we split out our CSS into multiple files in order to ensure we only send the data a user needs, we end up with quite a few CSS files, so combining and gzipping them is a helpful technique. Use this setting only when going live as any changes you make to those files will not be picked up immediately as the browser is being sent 'combined and cached' versions. Also sometimes the in-browser caching and optimization can out-weight the benefits of this setting. So use Firebug or Safari/Chrome web-inspector to see if your performance is improved by enabling this setting. It almost always is helpful, and sometimes dramatically, but we've seen instances where it doesn't help also. Moral is, to try it yourself for your particular setup. NOTE: SHOULD NOT BE USED IN CONJUNCTION WITH ROKGZIPPER. SEE BELOW.

* Plugin Manager - RokGantry Cache : This was an experimental plugin that has traditionally only been included in the RocketLauncher packages. Basically this plugin is a helper for the Gantry Cache setting. It flushes the cache when you make any changes in Joomla that could potentially impact the Gantry cache. For example if you published a module, then it would flush the cache as Gantry needs to know how many modules are published in a particular position. We are now going to start including this module in the Gantry "bundle" download as it has proved quite useful. We recommend enabling this if it's available.

Extensions

* Plugin Manager - System-RokGZipper : RokGZipper is basically a more powerful version of the Gantry GZipper option, so please read the description of Gantry GZipper above to get a feel for what RokGZipper does and why. Where Gantry GZipper only handles it's own Gantry-based CSS and JS files, RokGzipper will attempt to combine and compress all CSS and JS it finds on a page. This means it can help with all 3rd party extension CSS and JS as well as the files generated by the template. Again as with Gantry GZipper, you should enable this towards 'go-live' time and ensure that performance is in fact improved. We recommend using RokGZipper instead of Gantry GZipper if both are available as RokGZipper is more powerful and works across the whole page. However, Gantry GZipper is often better than nothing if you don't have RokGZipper installed. Our recommendation is to enable this for 'live' sites and disable the Gantry GZipper option.