Your Joomla Website Is Really, Really Slow? Maybe It’s an Extension!

One of the companies that we regularly do work for complained about a sudden slowness issue with their Joomla website. They said that their Joomla websites was taking about half a minute to load. So, we tested the website, and it was taking exactly 30 seconds to load – and that was on each attempt. That was odd!

We immediately thought that the website was hacked (since extreme slowness is a sign of a compromised website) but it wasn’t. The website was perferctly clean. We then thought, it might be a firewall issue, which made perfect sense since wrong firewall settings can cause this behavior. But it was not! The website was slow even from within the company’s network (their data center was on-premise).

So, we disabled all the plugins and the modules (yes – we followed our good old and reliable Joomla debugging technique), and we discovered it was one of the modules that was causing all this issue. In fact, that module was using curl to retrieve some information from a 3rd party website. Since that other website blocked all automated requests above a certain daily limit, the script was timing out in 30 seconds. So, why the 30 seconds, you might ask? It’s because the script had the following code:

curl_setopt($ch, CURLOPT_TIMEOUT, 30);

To fix the problem, we had one of 3 options:

  • Contact the 3rd party website and ask them to whitelist our client’s IP, which is something that we did, but unfortunately, that 3rd party website was a government website with rigid procedures (which is very normal).
  • Disable the module, which was out of the question because the company used that module to display some critical and up-to-date information to its clients.

  • Implement a caching system. In other words, send just one request every hour, and cache the results of that request, and, whenever the module has to be displayed, we retrieve the information from the local cache and not through curl.

The latter solution was the best, so we implemented it. We also created a cron job to retrieve the information every hour and store it in the cache. This has ensured that there would be no scenario where a page would hang on a visitor waiting to load some data from a 3rd party website.

As a rule of thumb, never use curl inside any of your Joomla extensions, since a curl call immediately makes your website (or at least part of your website) dependent on a 3rd party website that may or may not block your request, and that may or may not exist in a few months.

If your website is really slow and you suspect it’s one of your extensions, then we can fix the problem for you. All you need to do is to contact us and we’ll implement a professional for you in no time and for a very small fee.

One Response to “Your Joomla Website Is Really, Really Slow? Maybe It’s an Extension!”
  1. Pingback by Avoid Including External JavaScript Files on Your Joomla Website | itoctopus — November 20, 2013 @ 8:40 pm

    […] an extension that includes external files can slow down your whole website, and can jeopardize its rankings if the required external files are deemed to contain some sort of […]

Leave a comment