Joomla Performance Tuning: Module Cache
August 7, 2013 11:17pm
If you don't have a very busy website, chances are, you still don't care about Joomla performance tuning. But if you found this article through search, you are probably encountering slow performance from your Joomla website. You see hundreds of query from the page when you enable debugging. And in some cases, if you know Joomla caching, you just don't see the parameter on the module. Here's our first tip on how you can enable it and limit those query calls.
If you go to the Joomla Module directory, you will always see the PHP and XML file. The XML file stores the definition and parameters about that particular module. And in my experience as an end-user, I noticed that most of these modules usually don't go through proper design and implementation. Maybe the developer just thought of a cool idea to support some component and created a Joomla module in a flash.
What is param cache? This is a very special parameter in Joomla Module. And in most module that I have used, this is missing. This tells Joomla to cache the module when it is enabled. What does exactly happens when Joomla cache the module? For example, the module displays the latest 10 ads in an ads components. If the developer is good, the module might have 1 query, if he's not it might have 10. Yes, I bought a commercial component and a module came with it that stupendously executes 10 queries.
So when Joomla cache this module, it means the module will only execute the query once when it initially loads the page that displays the module. So when a second visitor visits that page, all it's doing is reading the cache (it's a file from your cache directory) from your server. There are no query calls and thus improves your website performance. It will only execute the query again when the cache expires. You set this expiration time on the Site Global Configuration.
Adding Param Cache
I have another website that became so busy this past few months. It was using Moset's Hot Property and Mosets Tree. It started pushing up my server load and it was slow. When I started debugging it, it was executing 100+ queries on the frontpage. I looked at all the modules that I was using and most of it was missing the cache param. You need to do 2 things: add the cache param on the XML file and enable caching on the module from the Administrator. After I've done these 2 steps, the query calls were reduced to 50%. That is a big performance boost.
- Editing the modules XML file.
XML file is a specially formatted file. So you need to be careful where you add the param cache. You need to add this inside the <params> field.
<param name="cache" type="radio" default="0" label="Enable Cache" description="Select whether to cache the content of this module">
- Enabling module caching from Administrator.