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.

Joomla Modules

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.

Param Cache

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.

  1. 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">
        <option value="0">No</option>
        <option value="1">Yes</option>

  2. Enabling module caching from Administrator.


3 Reponses

  Post Response


This sounds like a great solution that I would like to try. Pardon my ineptitude, but which modules.xml file? I am using Joomla 3.1 with the Isis admin template, and the only modules.xml file that I have found that might make sense has no predefined <params>. section, which is in this file path: /administrator/components/com_modules/modules.xml.

I am missing something. May I ask where I can find the requisite file?

Thank you!

  lhleditor November 1, 2013 4:15pm reply (1)

@lhleditor: I have to check if this was changed for your version. But in older version there is usually an accompying .xml file for each modules. The .xml file basically stores the module settings such as caching.

So this was normally in /modules/mod_modulename.xml

  admin November 15, 2013 3:13pm reply

Amazing joomla performance tuning tip!

  Din22 August 10, 2013 8:59pm reply (0)
Liked By