A very useful article that solved my Joomla problem!!
Slow Performance Joomla Using Too Many Resources
Sunday, 20 May 2007
by Conan Stevens
Joomla slow? Not if you follow the intructions below to speed up Joomla, attract additional visitors and get them to stay longer (more revenue anyone?)
My webhost took my Joomla site offline due to Joomla using too many resources, they said I was slowing the server and I was going to crash the server. Apparently too many MySQL queries were happening and causing an overload on my account and affecting the speed of other sites hosted on the same server.
So if Joomla PHP is killing your shared webhost account and your Joomla (Mambo) install is getting slow performance issues follow these steps...
First it was taking ages to load my site, Joomla (Mambo) was suffering slow performance, something had to be done for my readers but I kept putting it off as I was on a mission to write content. Then my shared webhost emailed me during a nice traffic spike and pulled my site offline! NO!!!
Looking into it more I found the following and took these steps to rectify the Joomla (Mambo) slow performance issues.
Fix For Slow Joomla (Mambo) Site
I was getting 200+ queries to the MySQL Database to build each page, the figure should be around 30-40 database queries per page, this was way too much and wholely responsible for the slow Joomla performance and the server CPU and Database overload.
Check MySQL Database Queries
To check this go to the backend admin and then Site -> Global Configuration -> Site -> Debug Site = Yes.
Make sure Override write protection while saving is ticked then apply the change. Now everytime you load a page (frontend or admin) you will have the number of MySQL databaase queries displayed as well as all the individual queries at the very bottom of your page.
Joomla Caching (Mambo too)
Caching, it needs to be turned on. Start with Site -> Global Configuration -> Cache -> Caching = yes.
Make sure Override write protection while saving is ticked then apply the change.
Turn Off Useless Stats
Go to Site -> Global Configuration -> Statistics -> Statistics = No. Make sure Override write protection while saving is ticked then apply the change.
These stats are useless and generate MySQL database queries for no decent reason, get rid of them and install another stats package which provides useful info like Joomlastats. Who cares which browser or OS visitors are using - all I want to know is how many people and what organic search terms brought them to me
Doing this got me down to 80-115 MySQL Database queries per page - much better but still not good enough.
Then go Modules -> Site Modules then go into each module seperately and look through the options most of these have the option to enable a cache as well. Enable the cache on every module that has the option.
Doing this got me down to 33-40 MySQL Database Queries per page - much better and acceptable.
Delete Unused Joomla Modules (Mambo too)
Also delete all the site modules that are not being used.
Delete all components and mambots that were not being used.
Even if they are unpublished some of these plugins can still be calling the Mysql Database due to inexperienced programming, better to get rid of the deadwood anyway for security as much as speed.
Optimise MySQL Database Tables
Next optimise your MySQL database tables, you will have to do this every so often, monthly for a heavy use site or 3 monthly for a light use site should do the trick;
Login to your phpMyAdmin DB tool.
Select the DB in question and scroll down to the session table.
Check the check box next to the table (session table or any tables having overhead values) and select the Optimize option from the drop down select list.
3rd Party Caching Components
Plus there are a couple of components and modules that help with caching and reducing server load, at time of writing the URL is http://extensions.joomla.org
Also turning off SEF urls will help (openSEF, etc) but then no one will be able to find your pages as Google won't index you properly so I do not advise this unless you really need too, even then question is there another way to get this working better?
Faster Web Hosting
As the next step I am moving the whole Joomla site over to a Virtual Private Host (VPS) so that I have full control of the 'machine' that my site runs on, thus we can choose the setup and run it our way - Debian install with minimum config.
We are also moving from Apache webserver to Lighttpd as it is MUCH faster and less load intensive, we are guessing we'll get 10 times the traffic onto a llighttpd box than an Apache box.
Secondly for our own box we have set up memcache to keep HTML copies of all recently seen pages in RAM, this makes a huge difference to speed and will help a lot next time I get 1 page hammered by a major movie site, digg, or any other slashdot effect page.
Comparing the two installs I currently have running the new box is *SIGNIFICANTLY* quicker even on non cached pages, like a 1 second page load compared to 5-6 seconds.
Now I am thinking with a nice fast site readers will stick around longer and I will get more pageviews, more pageviews means more advertising shown which means more revenue. (UPDATE: True page views are up 25% - 50% each day after the speed improvements not including the move to the new server)
Website load speed and uptime are part of Googles (trustrank?) search engine placement algorythm. A faster site with it's individual IP address and very little downtime is considered a more important page than a shared host with speed issues, therefore you will attract more visitors from the Search Engines (well google at any rate)
Friends who live on their online earnings have told me the faster servers more than pay for themselves with the additional ad revenues.
I'll have to wait and see, but I believe it.
There you go now you should never have to search for "Joomla slow" again