Autoptimize cache size: the canary in the coal mine

Update 23/06/2017: if you came here looking for solutions to Autoptimize cache-size problems after having (been) updated to AO 2.1.1; there’s a bug in that specific version, please update to either 2.1.2 or to the most recent stable version (currently 2.2.1).

Copy/ pasted straight from a support question on;

Auto-deleting the cache would only solve one problem you’re having (disk space), but there are 2 other problems -which I consider more important- that auto-cleaning can never solve:
1. you will be generating new autoptimized JS very regularly, which slows your site down for users who happen to be the unlucky ones requesting that page
2. a visitor going from page X to page Y will very likely have to request a different autoptimized JS file for page Y instead of using the one from page X from cache, again slowing your site down

So I actually consider the cache-size warning like a canary in the coal mines; if the canary dies, you know there’s a bigger problem.

You don’t (or shouldn’t) really want me to take away the canary! :)

11 thoughts on “Autoptimize cache size: the canary in the coal mine

  1. Mike Irish

    Thank You!!!
    Finally I think I understand more about the “caftty-cascheing” in AO.
    Your…. canary in the coal mine….allagory seems perfect to me!!

    Thanks so much…from a longtime user!

  2. /hauke

    firt of all, thank you for providing autoptimize!
    I don’t mind that ther cache grows big – however, the blinking red circle annoys my editor-in-chief :-)
    Is there any way to set the threshold where it starts to blink? e.g., 10 GB or whatever?

    Thank you,

    1. frank Post author

      sure, using the API;
      function change_maxsize() {
      return 10*1024*1024;

      1. /hauke

        Wow, that was one fast reply! ;)
        Since I’m not really into wordpress-hacking – which of the many php scripts should this be placed in? Preferably something that does not get overwritten the next time I update either wp itself, your plugin or my theme – is there any such thing?
        (And, here’s the feature request: how about making the sizeconfigurable in settings?)



  3. /hauke

    Uh, that’s one great tip to use that code snippet thingie, thank you very much – works like a charme!
    By the way, in order to achieve a 10 GB cache size you would have to set 10 * 1024 * 1024 * 1024 – you are using bytes, not kilobytes :).
    I’m trying 1 GB, and for now that seems to be ok. In your opinion, is a cache size of ~750 MB too big? I know that it probably depends on roughly a milion factors – I’m just curious why it is as “big” as it is. So far it’s not really a problem, but I’m wondering: Is my canary about to die?

    Thanks again,


    1. frank Post author

      well, 750MB does mean you’ve got a lot of different JS-files, which means that (assuming you have on average half a MB per JS-file) at least 1500 visitors had to wait for the JS-file to be created. I would try to find a way for more reuse of the cached files if I were you.

  4. /hauke

    PS: This is what I just got from my “editor in chief” after I applied your “fix”:
    Jaaaaa, DANKE! ❤ :* :* (Yesssss, THANK YOU!)

    So, now you know it was worth the time (at least for me ;-)

  5. Tom Townsend

    Is there a way to modify the email so that my client does not get it but I do ? I am an admin on the account but this is a fortune company and their IT is the default admin unless a plugin has an alternate way to pick the admin for the email.



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.