WP Rocket is by far the most popular WordPress plugin for full-page caching, minification, and CDN integration. However, users have often reported high CPU Usage while using WP Rocket Plugin.
WP Rocket high CPU Usage Causes and Fix
While there can be several other reasons for the high CPU Usage, we shall focus on the issues caused by WP Rocket and how we can fix them.
Use Cache Feature Properly
You may not be using the Cache Feature properly. Please make sure you have activated WP Rocket and turned on the Cache feature. While it may take some time for the cache to be generated.
Here’s how to check if WP Rocket is caching your pages.
Cache Preloading
Preloading creates a cache based on a sitemap. Preloading will increase CPU consumption if your site has many pages to preload and/or not enough server resources. If the increase affects your site negatively, you can try:
- Limiting the total number of URLs that can be preloaded in a single Preload event, decreasing its frequency, and adding a delay between queries for the same URL. To customize preload parameters, refer to this article.
- Make sure to change the cache lifetime to a longer time frame, like 48-72 hours, as doing so will result in fewer cache regenerations. Refer to this article on cache lifespan.
- It is also feasible to set up a cron job to delete the cache and preload, which is more important if the site sees periods of low traffic.
Remove Unused CSS
The Remove Unused CSS feature is the another reason that may result in increased CPU consumption. However, if you are using the plugin version 3.12 or higher, there are settings in the filters in the plugin’s core that can be altered to reduce CPU consumption when generating the utilized CSS. Fewer requests can be processed at once thanks to these settings, and longer processing times between requests are made possible by extending the pending tasks cron interval.
On websites using the WP Rocket plugin, helper plugins for the preload and remove unused CSS features can be modified, set up, and activated.
If you see that the server for your website is being negatively impacted by using the minify and combine CSS and JS features, you can disable them. CPU consumption could rise if there are many JS and CSS files that need to be compressed.
The combined CSS option will be greyed out in the WP Rocket settings if the Remove Unused CSS feature is active. It is not essential to integrate CSS files into a single CSS file if the site server supports HTTP/2 or HTTP/3.
To make these modifications and then roll out the improvements to all of the connect child sites, the helper plugins for WP Rocket are simple to adapt for both the preload and the Remove Unused CSS capabilities.
Useful Links
- https://docs.wp-rocket.me/article/48-high-cpu-usage
- https://docs.wp-rocket.me/article/1715-customize-preload-parameters
- https://docs.wp-rocket.me/article/494-how-to-clear-cache-via-cron-job
- https://docs.wp-rocket.me/article/1691-customize-remove-unused-css-parameters
Liked it? you’ll love our services too. We Provide both Unmanaged Shared WordPress Hosting and Managed WordPress Hosting at affordable rates. Feel free to contact us for more info.