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
If your site has a lot of pages to preload and/or lacks enough server resources, preloading will cause a spike in CPU usage. If the spike causes a problem for your site you can try:
- Slow down the Preload speed by installing the following helper plugin:
📥 Download (.zip): WP Rocket | Change Preload Parameters
Developers: You can find the code for this plugin on GitHub.This helper will reduce the number of URLs of each Preload run, the frequency of the Preload run, and will increase the delay between the Preload requests. You can read more in the Customize Preload parameters article.
- Increasing the Cache Lifespan to avoid too frequent entire cache deletion and preloading.
- Setting up cron jobs to clear and preload the cache during periods of low server activity.
If disabling or limiting preload doesn't resolve the issue, try the steps below.
Remove Unused CSS
The process of generating Used CSS can cause high CPU usage.
You can reduce the Used CSS generation speed by installing the following helper plugin on your site:
📥 Download (.zip): WP Rocket | Change Remove Unused CSS Parameters
Developers: You can find the code for this plugin on GitHub.
This plugin decreases the number of Used CSS to process and the frequency of the processing, this should decrease the CPU usage in the cases where this optimization is causing it. See this article for more details: Customize Remove Unused CSS parameters.
Preload and Remove Unused CSS
If your site's CPU usage is heavily affected by the Preload and Remove Unused CSS options, you can also install this helper plugin:
📥 Download (.zip): WP Rocket | Change Parameters
Developers: You can find the code for this plugin on GitHub.
This helper will severely limit the speed of processing of the Preload and Remove Unused CSS options. Making it the best alternative for critical cases, where sites need to keep using the optimizations without affecting the CPU.
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.