WordPress can be used with small websites that receive just a few visitors all the way up to large enterprise websites that receive millions of visitors each month. However, in some situations where WordPress-powered websites are receiving a number of visitors, businesses may not be seeing the most efficient use of their server resources.
The following are just some of the techniques that can be used to optimise the performance of WordPress, which in turn will see the your system resource usage drop.
Introducing PHP and MySQL query caches
The purpose of caches or PHP and MySQL is quite simple – it reduces the number of times a particular file needs to be requested or a specific query needs to be run because files can be requested and stored in memory whilst queries only need to be run once, with the results then stored in memory until requested.
Considering that each time someone visits your homepage, the same queries are being run to display the same content, it makes sense to run these queries just once and then cache the results. MySQL query caching is something that you can configure through the my.cnf file that MySQL server relies on, however this also means that it can only be implemented on a Cloud VM or dedicated server and not shared hosting.
An enhancement for the application itself that you may want to consider is WP SuperCache. Even though this is a plugin, it can help to speed up your website by serving static HTML pages as opposed to having process a number of queries and scripts every time someone requests a page.
Don’t use lots of plugins
Whilst there are many free plugins available for WordPress and in many cases if there is something that you would like to do with WordPress, there’s usually a plugin available for that purpose, quite often these plugins can be poorly written and in situations where the application is having to load lots of extra files each time a single page is loaded then you are going to see performance impacted.
Increase the amount of memory allocated to PHP
As is the case with enabling MySQL query caching, you will need your own server if you are to increase the memory allocated to PHP as this requires access to the php.ini file that the running of PHP on your server is governed by. The amount by which you can increase the memory allocation is going to be dependent on the amount of RAM that you have installed and when considering this amount, you should take into account the amount of memory that has been assigned specifically for other purposes.
In order to make sure that you effectively increase the RAM allocation, you will need to set the following values:
- ‘php_value memory_limit’ in the .htaccess file for your WordPress installation
- ‘memory_limit’ in your server’s php.ini file
- ‘WP_MEMORY_LIMIT’ in your wp-config.php file.
If you are considering starting a blog or website website and are looking for affordable hosting, visit our WordPress Hosting page.