High CPU usage
If you are experiencing high CPU usage on your site, there are a few possible ways WP Rocket could cause this:
Pages are not cached
Make sure that WP Rocket is active and caches your pages:
How to check if WP Rocket is caching your pages
Preload and Remove Unused CSS
If your site's CPU usage is affected by the Preload and/or Remove Unused CSS options, you can install this helper plugin:
📥 Download (.zip): WP Rocket | Change Parameters
Developers: You can find the code for this plugin on GitHub.
The next time the Preload and Used CSS generation run, the above helper will change the parameters as follows:
- Changes the limits of the preloading batch like this:
- Maximum number of URLs decreases from 45 to 25 URLs.
- Minimum number of URLs decreases from 5 to 3 URLs.
- Increase the waiting time between preloading batches, from 60 seconds to 120 seconds.
- Increase the waiting time between preload requests, from 0.5 seconds to 1 second.
- Reduce the batch of maximum URLs to generate the Used CSS for, from 100 URLs to 25 URLs.
- Increase the waiting time between Used CSS generation batches, from 60 seconds to 120 seconds.
When using this helper plugin, both options are limited at the same time because, in most cases, the Preload speed defines the Used CSS generation speed (as per this). And, limiting the Used CSS generation speed as such acts as guard too.
Therefore, this plugin is the solution for sites that need to keep using the Preload and Remove Unused CSS features, but without affecting the CPU and resources usage of their server.
LazyLoad for CSS background images
The LazyLoad for CSS background images feature has to process all the CSS of your pages.
Therefore, this feature can cause problems to the CPU usage if the site has a lot of CSS or the server doesn't have enough resources. The more CSS the site has, the higher the impact this can have on the CPU usage.
Unfortunately, there's no available workaround. So, if you're having this problem when using this feature, you'd need to keep it deactivated.
Excessive cache clearing
Sometimes, you might notice the cache is being cleared randomly, without a clear explanation, and this can cause CPU issues because cached won't be available, and the requests will reach the server with more frequency.
Please check our Cache is incomplete, cleared too frequently or randomly guide for more information.
Other file optimizations
Occasionally some of the other options on the File Optimization tab, such as Minify/Combine can cause high CPU usage in cases where your site has a lot of CSS or JS files. Try disabling these options and then monitor your CPU usage to see if it helps.