Your Joomla Website Is Really Really Slow? Maybe MySQL Is Running Out of RAM

One of our clients called us today and told us that his Joomla website was slow to load. We checked the website immediately, and not only it was slow, it was extremely slow. It was taking about 20 seconds to load.

We went through the following checklist:

  • Was the website hacked?: It wasn’t. In fact, it was a very clean and basic website with only VirtueMart installed.
  • Was any 3rd party extension trying to load remote content?: That wasn’t the case. The client had just one extension that was 3rd party, and it was VirtueMart.

  • Was the website hitting the maximum number of Apache clients?: It actually was, and we increased that number (the maximum number of Apache clients), but the problem still occurred, albeit less frequently. In short, that only addressed part of the problem.

  • Was it the firewall?: The website wasn’t even behind a firewall, so the SYN_FLOOD settings that usually cause these slowdowns were irrelevant.

  • Were there any slow queries?: We checked the MySQL query log, and there wasn’t any recent slow queries (there were a few but they were from months ago).

Interesting. What could the problem be?

We then checked the load on the server and we noticed 2 things: 1) it wasn’t low (below 2), and 2) MySQL was maxed out when it comes to RAM. In fact, only 128 Megabytes of RAM were assigned to MySQL and MySQL was using them all, and after the RAM was exhausted, MySQL was using a swap file as an auxiliary RAM to satisfy its needs! Aha! Now that we know the cause of the problem, we know the solution…

Here’s what we did to fix the problem (note that our client is using WHM, so the instructions below might be different if you’re using Plesk):

  • We logged in through ssh to the server.
  • We opened the file /etc/my.cnf (using vi).

  • We changed the values of tmp_table_size, max_heap_table_size, innodb_buffer_pool_size to 196 MB (it was set to 128 MB before). We did that by replacing the lines below:


    with these ones:


We restarted MySQL from WHM (you can also restart MySQL from ssh) and the website was flying! We solved the problem!

If you have a slowness problem on your Joomla website then check if it’s MySQL. If it’s not, then check your firewall, your Apache settings, whether your website is hacked, and whether you have a rogue extension. If ever need help, keep in mind that you can always contact us (we work 24/7/365). Please note that our affordable fees apply!

No comments yet.

Leave a comment