Website performance - To cache, or not to cache in Joomla! ?

in Uncategorized, Development on 25 Feb 2015 having 2 comments

Why go slow when you can go faster... right? The truth is - site visitors get agravated if an website takes forever to load and will eventually find relevant content somewhere else. Needless to say that user browsing experience has a big thing to say when it comes down to SEO ranking. There are a lot of factors that take a toll within the overall page load time, but here we will focus on what you can do to improve website performance from a Joomla! configuration point of view, namely cache.

Cache ?

Yes, cache. For those of you who are not familiar with it, is a generic term designed to describe content that has been generated before. Why have the server calculate responses over and over and perform database queries to generate the same content, when you can do it once and then simply show the output ? Cache it!

Things are not always that simple as speed often requires planning and an analysis on the actual content that is displayed. Hopefully the following article will provide a good understanding on how Joomla! cache works and which one to choose for your website.

So, Joomla! cache then!

Joomla! does provide several cache mechanisms designed to cover as many as user case scenarios as possible. Here are all of them:

Page cache Extensions > Plugin Manager > System cache

Fast and easy to use, the page cache acts as like a page snapshot. It caches everything: modules, components, plugins and templates.

Additionaly, via the Use Browser Caching option, it can instruct the visitors' browser to store the page content, thus when a page will be loaded again (by the same visitor and browser) it will deliver content from the browser cache, not from your site server.

Page Cache
Remember
  • Not applied for registered level pages.
  • Suitable for websites with static content without registered access level ussage - presentation, portfolio websites
View and module cache System > Global configuration > System

Different from Page cache, this option allows you to have more control over what parts of a page to cache. This is suitable for websites that incorporate dynamic content as well.

The global cache option is actually devised in two: Progressive and Conservative. But what does this exactly mean ? Well, the progressive type generates cache specific for each visitor. Let's assume that you have a module that provides some visitor specific details. The cached version would differ for each and every (uniqe) visitor.

The Conservative type on the other hand, delivers the same content to all visitors. If we use the same example as before, visitor X access the page first (no cache reference exists at this point) - Joomla! creates the cache reference. Now, all other visitors will get the content generated for visitor X.

On a functional level, conservative cache allows you to control the cache for each module whereas, the progressive one, caches the entire set of modules given on a page.

The Cache handler option represents the systems that are available for cache operations installed on your server. Commonly two options are provided: Cache_Lite and File

The Cache Time option allows you to set an availability period. Once a cache reference is created, it shouldn't be available for all eternity. It should expire at one point. By default this is set to 15 minutes. Once it expires this will be replaced by a new version. If your page has new content every few minutes, naturally, you should keep the time to a low value.

But what about module cache ? Is it a "all or nothing" deal ? Luckly, no. Joomla! allows you to control this per module. By default, each module has standard cache options: Use global cache / none and Timing. Note that this applies for conservative cache type.

Page Cache
Remember
  • There are very few cases where Progressive cache can be used. A good read about this topic is available here - though a little bit older it still applies for Joomla! 3.
  • Avoid caching dynamic content.
  • Control cache per module for optimal results.
Purge expired cache System > Maintenance > Clear cache

From time to time it is best to get rid of the expired cache. Depending on your site and cache options, files can add up rather quick, taking up unnecessary server space.

Lets assume that you have modified one of your articles. Naturally you would like to see how changes are reflected within the frontend area. To be able to do this, select the com_content entry and click delete.

Clearing Cache

Testing Joomla! cache

The following tests were done on a Joomla! 3.3.6 installation with standard Joomla! sample data content.

System Cache plugin
# homepage search page - same keyword
Caching off 900ms 900ms
Plugin enabled 711ms 800ms
Use Browser Caching 660ms 750ms
Global Configuration cache
User Profile page Caching off Conservative Progressive
User 1 1.63s 1.23s 1.34s
User 2 1.56s 1.38s 1.19s
User 3 1.44s 1.29s 1.40s

Third party tools

Some of you may have noticed that Joomla Extensions Directory has a special section designed for site performance. If you ask me, these 2 stand out:

  • Cache cleaner: it facilitates cache cleaning operation. Basically you won't have to access the Clear cache area everytime you make a change. It will place a small button within your navigation area that will allow you to clear the cache with a simple click.

  • JotCache: increases the overall flexibility of the cache system by allowing more granular control (per menu item for example) and an exclusion tool

Conclusion

I would say, YES, use cache, but don't do it blindly. Take your time, analyze the structure of your content, make tests (separate installation). A superfiacial approach on the cache subject can cost you dearly.

Subscribe for more tips and tricks


Subscribe to our blog

Found this article interesting? Subscribe to our blog for more.



Gravatar
Andreas - 26.02.2015 (00:54:26)
Thanks

Thanks for this great summary. After many years of using Joomla, I´ve finally understood the difference between "conservati ve" and "progressiv e" cache handling.

Regards, Andreas

Quote
2

Gravatar
Alexander Hammer - 25.02.2015 (07:43:57)
Good overview and comparision

Thanks for sharing this good made overview and comparison of Joomla caching possibilities.

Thanks Alexander aka Chefkoch

PS: RSFormPro! is just great!

Quote
2

1000 Characters left