The WP Rocket plugin is a commonly used solution for full-page caching, minification, and CDN integration. The plugin has two features that can contribute to higher CPU usage on the site’s server if used without changes to the default settings.
1. Preloading Resources
The first feature is preload, this is when the cache is created based on a sitemap of the site. First, make sure to adjust the cache lifetime to a more extended period, such as 24 hours this will mean that the cache does not have to be regenerated so frequently.
The preload feature has parameters that can be adjusted using the filters in the WP Rocket plugin to adjust the batch size, the interval between batches, and the delay between the requests.
It is also possible to set up a cron job to clear the cache and preload, which is more relevant if the site has low traffic for periods.
2. Remove Unused CSS
The second feature that can lead to higher CPU usage is the Remove Unused CSS feature. Generating the used CSS can increase CPU usage, but if you are using at least version 3.12 of the plugin, then it has parameters in the filters in the plugin’s core that can be modified.
The parameters allow the pending jobs cron rows count to be adjusted, allowing for fewer requests at a time, and increasing the pending jobs cron interval will allow for more time to process between requests.
Using the minify JS and CSS and the combined CSS feature can contribute to higher CPU usage and can be disabled if you notice that it is affecting your site’s server. If many JS and CSS files need to be minified, it can increase CPU usage.
If the Remove Unused CSS feature is enabled, the combined CSS feature will be greyed out in the WP Rocket settings. If the site server has HTTP/2 or HTTP/3 enabled, it is unnecessary to combine CSS files into one single CSS file.
The helper plugins for WP Rocket are easy to modify for both the preload and the Remove Unused CSS features to make those adjustments and then deploy those fixes to all of the connect child sites.