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.
Don’t use lots of plugins
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.