• Resolved gpeipman

    (@gpeipman)


    Hi,

    I have two WordPress servers behind load balancer and I need to use some network location for Autoptimize cache. What’s the best way to do it?

    Here’s the reason why I need it. Suppose user came to page and request was directed to server1. Server1 returns HTML mark-up with links to images, scripts and CSS. The browser starts downloading content behind the links. If request to Autoptimize cache should go to server2 and there’s no cached version of script then request to CSS ends with error 404.

    As my site is running on Microsoft Azure I plan to go with Azure File Storage account mounted to server1 and server2. This way I can be sure that Autoptimize cache is in sync for both machines and Google search tools are happy with my pages.

    With best regards,
    Gunnar Peipman

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Morning Gunnar;
    Ideally you set up sticky load-balancing and then you wouldn’t even have to bother. If that isn’t possible (or doesn’t work for you) then indeed writing to a common mount point (assuming that mount point is in the web root so the web server can read from it) should indeed work as well.

    Hope this helps,
    frank

    Thread Starter gpeipman

    (@gpeipman)

    Sticky load-balancing and other more advanced ones come on Azure with way higher price tag. Additionally these options doesn’t distribute load well as requests to one VM are not distributed to others.

    What are the options for me with basic load-balancing? Should I make Autoptimize cache folder to symlink that points to shared storage? Or is there some script variable I can modify?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Symlinks: depends on web server config I guess (Apache has a FollowSymLinks directive for example).

    The better option would be to change the directory where AO stores it’s files, more info in this FAQ entry.

    Happy optimizing ??
    frank

    Thread Starter gpeipman

    (@gpeipman)

    It seems to work now with Azure File Shares. Files are written there and everything seems to work. I started new mobile friendliness validations on Google Search Console and I will wait until these are done by Google.

    Meanwhile one question. Although files are written to file share I saw the number of CSS files growing and decreasing. First attempts to start validation in search console gave me immediate result that some pages are invalid. During requests by Google files were generated and some of them later disappeared magically. What causes this behavior? Is it possible to leave once generated scripts to disk for let’s say two days to make sure that all clients have already invalidated these?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Hmmm, AO itself does not ever remove files except when told so by someone clicking the “save settings and clear cache”-button on the settings-screen, but this can be triggered by others (themes/ plugins) hooking into AO’s API (calling autoptimizeCache::clearall()), so maybe you’ll have to look into who might be doing so?

    Thread Starter gpeipman

    (@gpeipman)

    It’s a little bit weird. During ~2h after moving to file shares the number of scripts and styles changed. 24 files and then 14 files etc. But it stabilized over day. I checked plugins and themes – none of these calls clearall(). I’m not yet sure what actually made files disappear.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    have you been able to fix/ stabelize this gpeipman ?

    Thread Starter gpeipman

    (@gpeipman)

    Hi,

    I can confirm it works stable now. Styles and scripts live on mounted Azure File Shares and there’s no issues when files are served directly from WordPress. I think this solution can be confirmed as working.

    My next experiment will be with Azure Blob Storage (some higher tier) so Autoptimize files can be automatically picked up by CDN.

    One things I noticed – files from Autoptimize folders are deleted when cleaning WP Super Cache caches. Not sure what it is exactly doing or why but there’s a correlation. Everytime I clean WP Super Cache caches the number of Autoptimize files drops. Again, I don’t know yet why it happens.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Everytime I clean WP Super Cache caches the number of Autoptimize files drops.

    this indeed happens; WP SC under certain config seems to simply wipe wp-content/cache (which also has AO’s cache). if need be you can fix by forcing AO to store it’s stuff elsewhere (e.g. in wp-content/uploads), using the constants described in the AO FAQ in the part about changing file locations.

    I’ll close this as resolved, but feel free to follow up here ??

    Thread Starter gpeipman

    (@gpeipman)

    I agree, this topic can be closed.

    About WP Super Cache – I try to solve this issue by making it using some other directory so it doesn’t wipe off things it shouldn’t touch.

    Thanks for helping me!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome, feel free to leave a review of the plugin and support here! ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Keeping Autoptimize cache on mount’ is closed to new replies.