This article will help troubleshooting high CPU consumption and provide steps you can take to improve WordPress performance
WordPress can be optimised for excellent performance however too often we discover WordPress websites performing poorly and consuming high CPU. Common causes can be poorly developed plugins or themes, page builders such as Divi, WPBakery or Elementor, too many installed plugins, no caching, and the list goes on.
Before commencing, please install any available updates for WordPress core, installed plugins and themes (generating a backup prior is recommended).
1. Install a caching plugin
Caching plugins such as W3 Fastest Cache or LiteSpeed Cache (if your hosted on a LiteSpeed web server) can dramatically reduce CPU load by caching static copies of your website pages. When a website is not cached, the server has to process the page each time a user browses consuming CPU and memory.
If you're already running a caching plugin, but still experience high CPU loads, make sure to check your website is being cached successfully.
You could use GTMetrix' Performance tool to check whether caching is enabled, or if you're familiar with terminal, you could use the below curl command to check whether the cache headers are correctly set and the cache service is being "hit":
curl -i https://yourdomain.com
Please ensure to update the command with your domain name.
Note: some caching plugins don't set headers indicating a cache hit.
2. Use the latest PHP version
Make sure to keep you website running on the latest version of PHP. You can update the PHP version via the Select PHP Version function in cPanel.
3. Disable WP-Cron
WP-Cron manages all the scheduled events in your WordPress site. WP-Cron is a very common cause of high CPU loads as it is called every time someone visits your website.
You can disable WP-Cron within the wp-config.php file using the below entry:
To manage cron jobs efficiently, you can create any required cron jobs using the Cron Jobs function in cPanel, it would be recommended to scheduled cron jobs for outside of peak website traffic.
4. Only use reputable plugins
Before installing any plugin on your webpage, you should research the plugins performance and revise user reviews. Only use plugins that are reputable and try to avoid using beta versions of plugins, often while plugins are during the development phase developers are still discovering performance issues related to the code base, for this reason, try to use only stable plugin releases.
5. Increase PHP Memory Limit
Occasionally increasing the amount of memory available to your WordPress website can help fix high CPU errors in WordPress. We recommend increasing your PHP memory to 256MB.
6. Only use plugins crucial to website operations
Any plugin which is not absolutely required for the functionality of your website should be removed. For example, plugins such as Redirection, Really Simple SSL, Broken Link Checker, Duplicate Posts.
All of these plugins are offering functions which are not crucial to the operation of your website. Furthermore generally plugins function can be configured on a server level, making the function much more efficient while not increasing load on the application.
7. Avoid resource heavy plugins and themes
When using resource heavy plugins or themes, it is important you are aware of the limitations these plugins or themes have on the performance of your website, for example WooCommerce, Divi, Backup Buddy and Avada themes will use an enormous amount of resources without traffic.
If you are running any of these plugins or themes, it may be necessary to consider (if you haven't already) upgrading to the DinoBiggest subscription which offers additional CPU and RAM resources to support the running of the website.
8. Optimize images
The larger the page size is, the longer it will take to load. All images should be scaled to fit their "container" during development, you can analyze your website assets using GTMetrix' performance tool to identify any images which are being automatically resized by the theme or other area of the websites code base. Make sure to resize these images appropriately so the website doesn't process the resize each time a page is loaded.
9. Troubleshoot WordPress Theme performance
If you have completed all of the above steps or you have disabled all plugins and the website is still performing poorly, it's likely the issue is within the WordPress theme. If you're reluctant to update the website to a more reputable, better performing theme. Follow the below steps to troubleshoot performance further:
- Check error logs for problems. Check either the Error logs function in cPanel or ssh to your hosting server and view the error_log found within the document root of your website. If no errors are present, you may need to enable error reporting. This can be completed within the Select PHP Version function, you can also enable logging via wp-config.php by setting WP_DEBUG to true.
- Contact your theme developer and ask if there's any known issues, also revise user reviews on WordPress forums.
- Disable any dynamic features built into the theme such as automatic image resizing.
- Disable Lazy Load features
10. Employ a CDN service
If your website is rendering a lot of high resolution images or struggling during times of increased visitors, employ a CDN (Content Delivery Network) to offload the website assets during peak traffic. A CDN is also great if you website is being accessed by visitors in different regions, you can configure the CDN to serve website assets from CDN servers located all over the world.
11. Third Party Plugin Update Check
Plugins such as The WordPress Plugin Update Checker, JetPack Auto Plugin Update feature, Simba or other services which monitor/manage your plugin or theme updates process regular GET requests to the plugin vendor's server to identify whether there are updates available.
The problem is, each GET request blocks further requests until the initial GET request is processed. Consider the performance detriment caused while there are numerous GET requests queued for each plugin or theme installed on your website.
WordPress has inbuilt plugin update features so you're alerted whenever a update becomes available so this "function" provided by various plugins is causing performance detriment while also totally unnecessary for the running of the website and should be disabled/removed.
Last updated November 30, 2023