• Resolved meijin2k

    (@meijin2k)


    Hi Frank! Before I tell you what is going on and ask for your assistance, please let me tell you something. First, I am a newbie and barely know enough to be dangerous. Seriously. Second, if I say something that comes off like I am blaming or otherwise ragging on your plugin, I am NOT. I replaced BWP with Autoptimize and immediately got better results. So..OK…

    Here’s the deal. I am running WordPress (obviously) with Woocommerce (using the Flatsome theme, very popular) with W3 Total Cache and have integrated both CloudFlare and MaxCDN. While troubleshooting some issues with MaxCDN related to speed, they indicated to me that the excessive “blocking” I was seeing had something to do with Autoptimize due to “how it was loading things” or “where it was loading things” (top or bottom of the page?). So, I have HTML, JS and CS optimization options set. I believe MaxCDN told me to check inline all CSS. And then under the CDN I have https://cdn-airbluewatches.netdna-ssl.com. It says that I have 644 cached styles and scripts (I don’t know if that is an overly large number or not) and then the Save aggregated script/css option is checked.

    What happens when I run a speed test is that everything starts loading normally and quickly. Then, around the 5th or 6th item in the waterfall, a Autoptimize JS file is “loaded” with a very long timeframe…in the last test I ran it was 2719ms. Then, almost every item under that has very large blocking times and MaxCDN (as I understood them, remember I am a newbie) said that because of where the Autoptimize is loading (and the time I am assuming), it is blocking the other elements coming after it from loading until it is completed.

    Damn I hope all that made sense and I didn’t make myself look to silly so far.

    So, I am wondering if you can help me with might be set incorrectly and be causing this to speed things up a bit. I am sorry if my explanation is jumbled or not using the right terms. If you need any additional info, I am happy to get it for you.

    Thank you for your time and help.

    https://wordpress.org/plugins/autoptimize/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Frank Goossens

    (@futtta)

    hi meijin2k;
    before going into specifics; I did a quick webpagetest.org test of your site myself, do those results seem more or less in line with what you saw?

    frank

    Thread Starter meijin2k

    (@meijin2k)

    Hey Frank! Thanks for such a quick response!

    The answer to your question is yes and no…LOL

    Shortly after leaving my message here, I was back with support at MaxCDN. They let me know that there was an issue with a setting called “Ignore cookies in requests”. Now, I have no damn idea what that has to do with Autoptimize. BUT! As soon as I did that and started running more tests, the JS file created by Autoptimize processed much faster. For instance, I just ran another test a couple of minutes ago and it processed in a little over 900ms when before it was well over 2000ms and sometimes approaching 3000ms. TTFB is WAY better. It was an F. Now it is an A. And the site speed picked up by about half. So, might want to file that away or the next time you run into someone using MaxCDN and CloudFlare. I am monitoring stats now to see if my cache hits start going back up.

    Like I said, no idea how this effects Autoptimize. I am still surprised as hell I got all of these moving parts working together this well so far! 😉

    Short of what now looks to be a non-issue, did any of the other settings stand out to you as being wrong on not optimized.

    And lastly, can I ask you about clearing the cache for Autoptimize? Should I have, now, 655 styles and scripts in cache? This is all new to me (totally) and I am trying to learn as fast as I can as I go along. Any insights you might be able to share would make me eternally grateful.

    And thank you, again, for such a speedy reply!

    Michael

    Thread Starter meijin2k

    (@meijin2k)

    Hey Frank, I think I might be getting a little further along here in figuring out what the issue is. So hang in there with me on this post, OK?

    So…on CloudFlare, I have a page rule (several actually) that looks like this:

    *airbluewatches.com/wp-admin*

    So, anything on my site that has “wp-admin” in the URL is bypassed in the cache. We don’t want to cache the backend admin area of WordPress. Unfortunately, the admin-ajax.php that is also slowing things down is in the wp-admin directory. So, when I look at the waterfall or HAR file, I see (if I am reading this right…remember I am a newbie) that Autoptimize is loading or calling admin-ajax.php and that one single event is taking 3402ms (and alot of the time longer). Here is where I am getting this from:

    URL: https://www.airbluewatches.com/wp-admin/admin-ajax.php
    Loaded By: https://cdn-airbluewatches.netdna-ssl.com/wp-content/cache/autoptimize/js/autoptimize_2542b674e4c515e4d9c833e6152c1957.js:2
    Host: http://www.airbluewatches.com
    Error/Status Code: 200
    Client Port: 0
    Request Start: 2.152 s
    Time to First Byte: 3400 ms
    Content Download: 2 ms
    Bytes In (downloaded): 1.1 KB
    Bytes Out (uploaded): 0.6 KB

    So am I crazy here? I don’t have half a clue as to why Autoptimize would be calling admin-ajax (a valid reason I am sure), but for anyone like me that is on a CDN, this is an issue. Do you think there is any way to work around this? I really want to keep using Autoptimize. I get so much better results with it than BWP Minify. Hell, for all I know, BWP is doing the same thing. My only other option, assuming I finally got something right, is to figure out a way to cache only the admin-ajax file (not sure if I should be doing that or not) and leaving the rest of the wp-admin directory alone.

    So, I’ll wait to hear back form you and see what you think.

    Thanks again for your help.

    Plugin Author Frank Goossens

    (@futtta)

    You’re learning fast Michael 🙂

    OK, so the cookie-setting makes sense, as when ignoring cookies maxcdn (probably) does not see a small difference in cookies as reason to request the same file from the origin server, which would slow things significantly down.

    As fas as the admin-ajax.php call is concerned; as Autoptimize simply aggregates all JS (and CSS) in a page, any plugin that inserts admin-ajax.php calls in your page will see it’s JS moved to the autoptimized JS. If you simply add “admin-ajax.php” (without the quotes) to the comma-seperated JS-optimization exclusion list, you’ll see the admin-ajax.php-calling JS inlin in your HTML. The problem however remains that admin-ajax.php can be slow (depends on what happens with that request, actually) and it indeed cannot be cached (e.g; WooCommerce uses it to get stuff from the backend).

    hope this clarifies,
    frank

    Thread Starter meijin2k

    (@meijin2k)

    LOL! Thanks Frank! I am an old dude…started writing code on an Apple II in Basic. So at least I learned to think reasonably logically.

    A couple more questions if I may?

    #1. After adding to the exclusion list, do I just save or save and clear cache?

    #2. Now that I am sitting there with just shy of 700 styles and scripts in the Autoptimize cache, when do I clear that?

    #3. Can you recommend any potential ways to find out where the call for the admin-ajax.php is coming from? I actually found Query Monitor and it looks like that might have a way to do it…I just don’t know that I have the chops to pull it off.

    Thanks again for your help Frank! Fortunately, due to this error I found your YouTube plugin and it looks like I can replace the crappy one I am using!

    Thread Starter meijin2k

    (@meijin2k)

    Unfortunately, no luck with the changes.

    Added the exclusion. Saved it (no purge). Flushed W3TC caches. Flushed CloudFlare. Re-ran the test and still the same thing.

    Too late for me now, after 2am.

    I look forward to any other ideas you might have.

    Plugin Author Frank Goossens

    (@futtta)

    regarding admin-ajax.php; you actually have 5 such calls declared in your HTML (look at your page source), 3 of them are WooCommerce’s (a.o. add-to-cart), one is from something called “mab” and one has no clear indication of the origin. Excluding admin-ajax from AO will indeed not make it faster. there’s no magic bullet here, I’m afraid, as admin-ajax implies that there’s AJAX-initiated logic running on your server and performance of that logic depends on complexity (and server resources).

    700 is still acceptable I guess, but it might indicate there’s not a lot of reuse of cached autoptimized CSS and/ or JS. Have a look in /wp-content/cache/autoptimize/css and /wp-content/cache/autoptimize/js, I guess most files will be in JS. In that case and if this continues to rise significantly, you might want to have a look at this sticky forum-topic and/or at the FAQ.

    Another idea; although inlining all CSS helps to make CSS non-render-blocking, I’m afraid the amount of CSS you have inlined that way is too big, so maybe compare webpagetest-results with and without all CSS inlined. If you’re adventurous you could even try “inline & defer” (although that is difficult to get just right, to be honest).

    frank

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Long load times, I think, due to Autoptimize’ is closed to new replies.