Title: High CPU when cache is cleared
Last modified: April 25, 2024

---

# High CPU when cache is cleared

 *  [vDerekS](https://wordpress.org/support/users/vdereks/)
 * (@vdereks)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/high-cpu-when-cache-is-cleared/)
 * Quite often when I update a blog post (using Elementor Pro), then clear the Autoptimize
   cache, a PHP process goes crazy, causes a >200% CPU load, and my site basically
   crashes. I have to reboot the entire VM to get my site back. Happens 95% of the
   time, if not more. Using the latest version of Autoptmize Pro. Been happening
   for quite some time (months).

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/high-cpu-when-cache-is-cleared/#post-17715000)
 * hey vdereks;
    We should first try to identify whether the problem is with the
   CSS/ JS cache (which is part of the free version of AO which I support here) 
   or with the page cache (which is part of AOPro and [which I can’t support here](https://wordpress.org/support/guidelines/#do-not-post-about-commercial-products)).
   Are you using AOPro page caching and if so does the problem go away when disabling
   that?
 * frank
 *  Thread Starter [vDerekS](https://wordpress.org/support/users/vdereks/)
 * (@vdereks)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/high-cpu-when-cache-is-cleared/#post-17715879)
 * I am NOT using page caching. Issue happens when clearing the JS/CSS cache. I’m
   not using JS optimizations, only CSS.
    -  This reply was modified 2 years, 1 month ago by [vDerekS](https://wordpress.org/support/users/vdereks/).
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/high-cpu-when-cache-is-cleared/#post-17715892)
 * OK, in that case this is an Autoptimize question and not an AOPro one so we can
   continue here 😉
 * Regarding the broader context; there is no need (or use) for clearing the AO 
   JS/ CSS cache when updating a page/ post really 😉
 * Regarding the high CPU usage; how big is your JS/ CSS cache when this happens(
   number of files/ total size in MB)?
 *  Thread Starter [vDerekS](https://wordpress.org/support/users/vdereks/)
 * (@vdereks)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/high-cpu-when-cache-is-cleared/#post-17715900)
 * Well it’s over 200MB and over 300 files.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/high-cpu-when-cache-is-cleared/#post-17715945)
 * that’s not a lot at all .. the “clear cache” logic is pretty straightforward 
   and has not changed in years, so the question is what changed months ago to trigger
   this high CPU load.
 * anyway, AO’s cache logic has an option to delete another way (with a rename instead
   of individual files being removed), you can trigger that advanced logic (which
   was built taking big cache sizes into account) by adding this code snippet;
 * `add_filter( 'autoptimize_filter_cache_clear_advanced', '__return_true' );`
 * maybe give that a try?
 *  Thread Starter [vDerekS](https://wordpress.org/support/users/vdereks/)
 * (@vdereks)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/high-cpu-when-cache-is-cleared/#post-17716706)
 * Where/how do I add that?
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/high-cpu-when-cache-is-cleared/#post-17716770)
 * The easiest & safest solution is using [the code snippets plugin](https://wordpress.org/plugins/code-snippets/)
   🙂
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [2 years ago](https://wordpress.org/support/topic/high-cpu-when-cache-is-cleared/#post-17756881)
 * So did this change fix the CPU load issue when clearing the cache [@vdereks](https://wordpress.org/support/users/vdereks/)?

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘High CPU when cache is cleared’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [2 years ago](https://wordpress.org/support/topic/high-cpu-when-cache-is-cleared/#post-17756881)
 * Status: not resolved