1 1 1 1 1
02Aug2017

Site performance—caching and file aggregation—is it worth it?

Information
581 hits Updated: 10 January 2018

Disable Joomla’s cache features

CSS/Javascript file aggregation: who needs it?

I wrote previously about the general theory of website caching.  There are circumstances when site caching can be useful and there are other circumstances—especially when people are attempting to diagnose, analyse and solve operational issues—when caching can become a headache.  As a general point, caching can be useful where “speed”—as far as the end user is concerned—is the number one criterion.

Similarly, when people turn to Google for recommendations on ways to “improve” [the end user perception of] performance, we find suggestions about using file aggregation, minification or obfuscation methods.  These are not related to caching but they are involved in overall “site performance” for want of a better description.

The bottom-line is that website caching, data compression and file aggregation/minification/obfuscation may help—and there is empirical evidence to support that contention—but they add administration overheads and, ultimately, their presence may not be beneficial—and there is a body of anecdotal evidence to support this opinion.  The problems caused by caching et al are the subjects of thousands of discussions in online technical forums; in most cases these problems are quickly and effortlessly resolved by disabling or removing those facilities.  This article provides information on the common techniques that people employ in Joomla and how to disable such features that they’ve (perhaps unwittingly) enabled or installed.

Disable Joomla’s cache features

Cache settings in J! 3.xThe image at the right (click to enlarge it) shows the Global Configuration settings that are principally responsible for server-side caching on a Joomla website.  Perhaps the most important of these settings is the last one—the one I have circled.  The System Cache setting [usually] has 3 possible values (although it’s possible to have others), these being:

  • OFF - Caching disabled
  • ON - Conservative caching
  • ON - Progressive caching

It is not important to understand the differences between the “ON” possibilities[1] or the purposes of the other settings in this area; the important point is to disable (i.e. turn “OFF”) the caching feature.

Server-side caching is also dependent on various facilities that need to be available on the webhost.  Therefore, if you want to make use of some features built into Joomla, you may need to know whether your webhosting provider has installed those particular features.  If you don’t have those facilities available then it may not be possible to enable some of Joomla’s built-in features anyway.  Thus, what you read here is only general advice and, if you have other questions, you may need to ask your webhosting service provider.

System - Page Cache pluginAnother source of problems lies with the use—or should I say, misuse—of the System - Page Cache plugin.  See the image at the right of the page to see what we are now discussing.

Some people read the words “page cache” plugin and, believing that this plugin will improve “site performance”, enable the plugin without understanding how it works or what issues it may create.  This plugin is disabled by default; there’s a good reason why some plugins are disabled by default:  most of the time you will never need them.  This begs the question “What does the System - Page Cache plugin do?”  Not a lot, really; there’s little useful documentation and there are reports that the facility is broken in Joomla 3.7[2].

Avoid the problems caused by this plugin:  if you don’t understand what it does, resist the tempation to enable the plugin; leave the plugin disabled.

So why have I been “lucky” and why have other people had so many problems?  The answer comes back to good management, keeping things simple and managing the risks.  Of course nothing is foolproof; problems happen but that doesn’t mean that one problem should reason enough to believe everything that you read.  Therefore, in the interests of helping others know how to minimise these risks, the following discussion of some helpful ways that that may avoid potential problems.

… and flush the cache

If you have followed the tips I’ve given in the preceding section of this article, and things still aren’t working for you—you’re still no closer to diagnosing the cause of problems that you’re having with your Joomla website—you’re possible that you’re looking at a “stale” (i.e. cached) copy of a website page.  It may be appropriate to “flush the cache”.

There are two places in the Joomla backend that you should also visit:

System » Clear Cache

and

System » Clear Expired Cache

… and don’t forget about the browser cache!

You may be wondering why people make such a fuss about caching when it seems to be responsible for so many problems?  That’s not entirely true (that caching causes problems); it may be better to say that disabling caching can improve how your website works for you and for the people who use your website.  Many of the problems we read are caused by people’s ignorance of caching and their forgetfulness in remembering that caching is the reason they’re experiencing problems they’ve not encountered before.  Therefore the first rule in problem analysis is to eliminate anything and everything that may be a possible factor.

This brings us to the effects of client-side/browser caching.  Your web browser also stores reusable information locally so that you do not have to visit the website as often.  That’s a good thing!  It reduces the load on the server, it reduces bandwidth and it boosts the “site performance”.  Unfortunately, it can also cause other headaches (particularly for website owners) when they see something odd or “broken”.  The Joomla forum is full of cases where site owners are panicked into asking for help and have discovered—to their embarrassment—that their “problems” could be fixed by pressing a couple of keys on the keyboard!

A lot of people will read “refresh the page” or “clear the cache” or “empty the browser cache” or “force a page reload” and they may be confused by these usages.  We’ll make it simple:  to reload a web page in Mozilla Firefox, Google Chrome, Internet Explorer, Safari, Opera, MS Edge usually means to press F5 key on the keyboard.

The F5 key

Pressing the F5 key “refreshes” the page leveraging whatever is currently stored in the browser cache.  This is not the same as forcing a page reload (i.e. clear the browser cache for that page and reloading everything relating to that page from the website).

Different browsers use different keycode combinations to force a web page reload.

Aggregation, minification and obfuscation

Optimising performance by aggregating CSS and Javascript files

Although this is a little off-topic to the issues we’ve discussed about caching, a lot of people will read recommendations about aggregating and minifying their CSS and Javascript files and will implement methods to achieve those things.  People often use resources they find on the internet such as Google’ PageSpeed page and accept, as an article-of-faith, that those recommendations are not only appropriate to their circumstances but are actually required as part of managing their sites.

Let’s be clear about something:  Google is not the only authority on these matters and, moreover, Google is not the final authority in adjudicating these matters.  It is always advisable to maintain a healthy scepticism about what various resources on the internet recommend even when those recommendations come from places as reputable as Google.  We need to remember that Google is not in business to provide anyone with helpful advice just out of the kindness of their corporate heart.  Google is in business—and it’s a very successful business—because their only purpose is to improve their market share, to improve their profitability and return on the investment of their shareholders, and they achieve this by encouraging their customers to purchase products that they advertise on the internet.

I don’t intend to discuss here the benefits of aggregating CSS and Javascript files (or how you might go about doing it) or the merits of minification or other “performance enhancing” methodologies.  It is sufficient to say that there are several products available as Joomla extensions that facilitate on-the-fly file aggregation/minification/compression “performance-enhancement” or, more broadly-speaking, “site optimisation” and people can judge for themselves where there may be benefits in using those tools.  As far as Joomla is concerned, these mechanisms are not part of the core product but they may be included as optional features of third-party extensions such as JCH Optimize and jbetolo[3] as well as some extra built-in features of templates.

Über-optimising”

No-one can make any guarantees that, when you combine several different files together, everything will continue to function perfectly.  Tools like JCH Optimize may actually deliver the benefits that people expect—they may be able to shave a few seconds’ savings of bandwidth even if that add a few extra milliseconds at the server end to generate the HTML package.  But sometimes these benefits also come with some unexpected problems that far outweigh their anticipated benefits.  These problems can include broken websites, HTTP 500 Internal Server errors, broken images, jumbled/messed up web pages and non-functioning [Javascript-driven] events.  Add to the mix the inability to diagnose the specific individual source of the problems because all the Javascript files have been clumped together and the CSS is one unfathomable pile of spaghetti-code and you have a nightmare challenge for any skilled diagnostician.

If you are one of those über-optimisers—the kind of person who takes everything written by Google as the word of God—then you may want to take things easy.  When you encounter problems with “broken” websites, when all the images on your site look like ,  when you get nothing but a white page and the only indication is a “HTTP 500 Internal Server Error” somewhere, when clickable buttons don’t click or your prized artwork looks like a five year-old child embellished it with a box of crayons, just remember that a contributing factor to these symptoms might be those performance-enhancing software steroids you injected into your site last week.  Therefore if you use these tools and you do not understand the problems they cause, the first thing you should do is disable them before you hurl a stream of invective on a technical self-help forum asking the self-answering question, “Why is my site all broken?”

We seek the Holy Grail of site optimisation and we often end up with a cracked egg cup of disappointment (and egg on our faces) instead.

Notes:

[1]  For further information about Joomla’s Cache Settings, see https://docs.joomla.org/Help37:Site_Global_Configuration#System:Site_Global_Configuration#System.

[2]  See also https://github.com/akeeba/fof/issues/657 and https://www.regularlabs.com/forum/cachecleaner/42592-should-i-disable-system-page-cache-plugin

[3]  JCH Optimize and jbetolo are two popular Joomla extensions for file aggregation, minification and compression; other tools include ScriptMerge, Too Many Files, Lab5 Übercompressor CSS, Site Faster and Rapi Website Compressor.

About the author:

is a Joomla professional and former member of the Kunena community for more than 8 years—a substantial contributor to the original Kunena documentation project with over twenty thousand messages posted at the Kunena forum. The opinions expressed in this article are entirely those of the author. View his profile here.



Comments  
# Raied 06-Aug-2017 07:13
Hello sir: Any chance to subscribe without using Paypal? Paypal not supporting my country and I cant link my Mastercard there; please advise. And sorry to write here, I could not find contact us page.
Reply | Reply with quote | Quote
# sozzled 06-Aug-2017 10:19
Dear Raied: Thank you for you enquiry, although it is not related to the topic. I do not use any "contact us" feature at this site because it is usually abused for spam. Also, I do not normally reply to off-topic comments posted in places like this. I am sorry that you cannot use your Mastercard with my Paypal.
Reply | Reply with quote | Quote
Add comment
By submitting this form you agree to the site policy. All guest comments are subject to approval before they will be published.