How to Optimise WordPress
Is your WordPress markedly slow? Or have our Technical Support team informed you that your Managed or Self-Managed server is experiencing high load which has a negative impact on server performance? Has your site been moved to one of our quarantine servers due to load issues in order to ensure optimal server performance for our other customers?
Consider the aspects below to optimise the performance of your site or server.
There are various tools available for testing your website’s speed and performance, such as PageSpeed Insights (from Google) and Pingdom. Use these to determine which aspects of your site or server needs some fine tuning.
Here are some aspects to investigate:
In most cases, caching is the most effective way to speed up your WordPress website, by reducing unnecessary reloading of pages. Caching creates static HTML versions of each website page which reduces the number of database queries or execution of PHP code, reducing the number of server requests.
These are popular WordPress caching plugins (only use one):
2. Plugin cleanup
Too many plugins, or some specific plugins, can drastically impact your site’s performance. This can be caused by:
- Database-intensive queries. Inefficient or complex queries can cause significant load times and poor performance.
- Plugin conflicts. Some plugins interact badly with other plugins or WordPress themes, causing performance issues.
WP Performance Profiling is one of many useful tools that highlight the effect that each plugin adds to your page loading time. Certain plugin types store more data than others in the database and can be the culprit that is placing high load on the CPU:
- Antispam plugins e.g. Akismet
- Backup plugins e.g. Backup Buddy
- Link tracking plugins
- Statistics plugins
- Security plugins
- Related Posts or Popular Post plugins
How to fix it:
Use systematic testing to isolate culprit plugins: deactivate them all and then reactivate one by one and run the test again. Note that even if deactivating a plugin improves performance, it may not be that specific plugin that is the culprit, but rather a conflict with another plugin.
3. Optimise the database
As your site grows, so will the database that runs it. Over time a lot of unnecessary data starts to bloat the database and maintenance is needed to keep it at an optimal performance level.
How to check it:
Query Monitor is a plugin which provides debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more. It highlights slow queries in red, which helps you to quickly identify problems.
If our Technical Support team inform you that it appears that high load issues are caused by database queries, then a debugging plugin like Query Monitor could help you to isolate the cause of the issue.
Factors that can unnecessarily increase the database size are
- Certain types of plugins (see Plugin Cleanup above)
- Spam comments
- Unused plugins and themes
How to fix it:
Plugins such as WP-optimize or Autoptimize or WP-sweep are great for cleaning up unnecessary data – but first create a complete WordPress backup of your site as changes made during cleanup are irreversible.
While the WordPress database is indexed by default, high server load is sometimes caused by poor database queries which may be resolved by additional indexing. There is no quick fix, though – the problem queries need to be addressed specifically.
However, what appears to be a database problem may not be; it may be a bad loop in a plugin that causes a good query to run too many times. Before trying further indexing, first do a plugin cleanup, and test plugins by deactivating them all and then reactivating one by one.
For further information: Finding and Fixing Slow WordPress Database Queries
4. Optimise images
Large, or poorly optimised images is a common reason for slow websites. They take up unnecessary space, add strain on the server and take a long time to load.
The aim with image optimisation is to find the best balance between image quality and file size: the file size of very high quality images is too large and causes slow loading, but fast loading small images may be of poor quality.
How to fix it:
- Ensure the images are in the correct file format
- Photographs or a complex images with lots of detail and colors should be JPEG.
- Screenshots, illustrations, or images with lots of text are best as PNG.
- For simple animation (but you don’t want to embed a video player), use GIF.
- Crop the image to focus on what is important. This reduces file size.
- Resize to a pixel width that is suitable for viewing e.g. 600pixels. Resizing should be done before uploading – although WordPress allows the option of displaying smaller versions, the full sized version is stored.
- Compress images using tools such as WP Smush , TinyPNG or CompressPNG/JPG
5. Optimise Video
6. Disable WP-cron
WordPress has a file called wp-cron.php that runs every time someone visits your site, which can severely throttle CPU usage and slow down busy sites.
Rather than letting wp-cron slow down your site, it should be disabled and let your system handle scheduled processes in the background — using a cronjob.
Disable wp-cron in WordPress
- Use FTP to access your server and navigate to the public_html folder
- Add this line at the bottom of your wp-config.php file
Enable a real cronjob
You can now schedule these wp-crons to run once every couple of hours instead, using the Cronjob Manager in konsoleH. The rule you can add is as follows:/usr/bin/php-wrapper /usr/www/users/ftpuser/wp-cron.php
If these solutions don’t resolve the high load or performance issues, then it is recommended that you get the services of a developer to help isolate and resolve the problem.
Once our Technical Support team contact you to advise you of load issues, the problem is already affecting your site or server performance and needs to be addressed with urgency. If your site is on one of our shared Web Hosting servers, your site may be moved to a temporary server to ensure that other sites are not negatively affected.
In the case of Managed Servers, although no other customers are directly affected, constant attention to load issues on your server affect the ability of our Sys Admin team to effectively monitor our entire network.
Our commitment is to alert you of load issues, providing an indication of what may be causing the high load, as well as snapshots of MySQL queries or logs. Note, though, that we don’t know the details of your site or server, and while we can offer suggestions, you will need to get the services of a developer if you aren’t able to resolve the issue yourself.
If the issue is not resolved after we alert you 3 times about incidents of high load, we will need to stop monitoring your Managed Dedicated Server until you inform us that the issue is finalised.
Website: WordPress Site