8 Ways to speed up Joomla! – Learn how to improve Joomla! performance with just a few config settings

灰暗的星星灰暗的星星灰暗的星星灰暗的星星灰暗的星星
 
分类:技术文章

All Joomla! performance changes and optimizations can be made through the administrator back-end of Joomla!, or by downloading and editing the configuration.php file. Don’t know how to download and edit the configuration.php file? Have a look at my Dutch article on how to edit files through FTP (Google Translate the article, or just look at the screenshots).

Let’s start tuning Joomla!

Joomla! MySQL database functions

Current versions of Joomla! can operate on MySQL, SQL Server and PostgreSQL database back-ends. For MySQL there are two interface choices: “MySQL” and “MySQLi“. Nowadays every Joomla! version supports the MySQLi database functions, so we want to use that.

The i in MySQLi stands for improved and is the recommended MySQL interface to use, and offers better performance.

 

We all know the old ext/mysql functions will be removed from PHP in the near future.

Update: ext/mysql is already removed since PHP 7.

The specified MySQL interface is defined in configuration.php:

public $dbtype = 'mysql';

Change this to mysqli:

public $dbtype = 'mysqli';

Joomla! Session handler

Optimize Joomla!’s session handler. By default, Joomla! stores all session information in its MySQL database. This can be ideal if both the MySQL database and Joomla! website are on the same physical server. When it’s not, this generates a lot of unnecessary traffic between the database and website, just to verify a session. For every visit. See the chart:

Joomla ACL decision flow-chart

Joomla ACL decision flow-chart

This, of course, is a performance drain.

Therefore, it’s recommended to store Joomla session information on the web server’s file system. This provides faster access to its session files and information.

How and where sessions are stored is defined by the Session Handler: $session_handler. When the session handler is set to 'database', change it to 'none':

public $session_handler = 'database';
public $session_handler = 'none';

Remove unused Components, Plugins, Modules, and Templates

Over time a lot of components, plugins and modules are installed, tested, and disabled on your website. This probably, goes for templates as well. When a request to your website is made and the PHP process starts up, it indexes all files in your website. Even those files of disabled components, plugins, modules and templates, simply because they are on the file system.

This may interest you:   Feedly Saotn.org RSS feed on Android

Going through the file system and indexing those unnecessary files takes up a lot of additional time (relatively), it’s best to simply remove (delete by FTP) all unneeded files and directories.

Convert your Joomla! MyISAM database tables to InnoDB

When you run Joomla! on your website for a longer period of time now, chances are your database tables are still using the older and less performing MyISAM storage engine. It is wise to update and convert these tables to InnoDB. The reason is that InnoDB is actively developed and MyISAM is not, therefore InnoDB tables provide more performance than older MyISAM.

Joomla cache handler – Set up a Joomla! caching handler with WinCache, Cache_Lite or File

Use caching in Joomla!

If your web hosting provider has WinCache available on the web server, then this will give a great performance boost for your website. If WinCache is not available, at least use Cache_Lite as cache handler: in your configuration.php, set $caching to 1 (enabled, conservative), or 2 for progressive caching.

Joomla Cache Settings where you can choose Cache_Lite

Joomla Cache Settings

Set Joomla!’s $cache_handler to File or cachelite:

public $caching = '1';
public $cache_handler = 'File';
 // public $cache_handler = 'cachelite';
 // or 'wincache' if available

Don’t forget to make sure your cache\ folder is writable.

WinCache for Joomla! 1.5?

WinCache as cache backend is not supported on Joomla! 1.5. You shouldn’t be using an ancient version like Joomla! 1.5 anymore! See Joomla!’s CMS versions for more information.

Anyway, if you’d like to add WinCache support for Joomla! 1.5, grab Don Raman’s wincache.php cache storage file from the blog post performance improvement in Joomla using WINCACHE user cache, and place the file in libraries\joomla\cache\storage. Now you can configure $cache_handler to utilize WinCache.

Joomla Gzip compression

Enable gzip in Joomla, you don’t want to have gzip disabled!

Gzip compression compresses the response body sent from the web server to the browser. A smaller file is downloaded faster, making visitors happy, and a happy visitor is a returning visitor. Gzip compression in Joomla! is also known as buffered output.

In your configuration.php file, locate

public $gzip = '0';

and set $gzip to 1, to enable gzip compression in Joomla!

public $gzip = '1';

Let me repeat: Enable Joomla! Gzip compression is one of the things you must do to make your website load faster. To Enable Gzip go to System > Global Configuration > Server – where you’ll find an option Gzip Page Compression. Simply click Yes and Save.

how to enable gzip compression in Joomla through the Server Settings screen

enable Gzip compression in Joomla!

To Disable Gzip go to System > Global Configuration > Server, set to No, and then Save.

This may interest you:   Decoupling Umbraco from your front-end website

Joomla! optimization extensions

There are many extensions that try to improve the performance of your Joomla! website. Like the earlier mentioned WinCache. Here are a few that I can recommend:

Bonus Tips: run an as high as possible Joomla version

Every new Joomla! version comes with new optimized PHP code, functions and settings. Use them! Always run an as high as possible Joomla! version to make use of these improvements.

Optimze and lossless compress images, minify JavaScript & CSS
Make sure your images are optimized for the web properly. Optimize and lossless compress images and minify JavaScript and CSS files is very easy to do. It drastically downsizes your website size (footprint), and making it load faster.

And further, curious how I optimized my web hosting? Learn how to do the same

Let’s be honest, PHP is PHP, so whether you use Joomla! as your CMS or Drupal or WordPress, most performance is gained through your PHP hosting environment. And MySQL, do not forget about your MySQL database server! So read how I optimized my web hosting environment, and start doing the same.

Pro tip: Learn how to optimize PHP on your website or IIS web server? Or just to improve OPcache settings.

Conclusion

Out-of-the-box, Joomla! is not very optimized for performance. With just a few basic tweaks and settings, we’ve optimized Joomla! performance extensively. Page loads are much faster. All changes can be made through the administrator back-end, or by downloading and editing the configuration.php file.