• Resolved theyuv

    (@theyuv)


    Hello,

    I am using autoptimize on 2 identical servers.
    I use a load balancer to distribute the load between the 2 servers.
    The wp-content/cache folder is not shared between the 2 servers (ie: each server has its own independent cache folder).

    Can this pose a problem?

    Thanks.

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

    (@futtta)

    probably not, except if you have a page cache which is in front of or shared between the 2 webservers. what you need to avoid is requests coming to serverA for autoptimized CSS/JS which only exist on serverB without WordPress being bootstrapped on serverA. if the autoptimized CSS/ JS exists on serverA OR if WordPress creates the HTML on serverA, then you’re OK.

    hope this clarifies,
    frank

    Thread Starter theyuv

    (@theyuv)

    Ok. Thanks for the very quick reply.
    Is there a better way that you would recommend to have it set up?

    Plugin Author Frank Goossens

    (@futtta)

    well, depends; does your loadbalancer also cache responses? having varnish in front, caching HTML & all (local) resources would improve performance quite a bit?

    Thread Starter theyuv

    (@theyuv)

    I don’t think my load balancer caches anything. I am using an Application Load Balancer (https://aws.amazon.com/elasticloadbalancing/applicationloadbalancer/)

    I’ll look into your suggestions. Thanks.

    Thread Starter theyuv

    (@theyuv)

    Hello again,

    Can you clarify a bit what you meant by “…without WordPress being bootstrapped on ServerA”?

    I’m still seeing some issues and I think it has to do with the caching.

    My Load Balancer isn’t “sticky” (a user can visit a page, and then if he chooses to return to that page later, I’m not guaranteed that he’ll be served from the same server as his original request).

    I’m already sharing the uploaded files folder. I could probably also share the autoptimize folder between the servers…

    Thanks.

    Plugin Author Frank Goossens

    (@futtta)

    well, suppose serverA has wp-content/cache/autoptimize/css/autopitmize_A.css that was generated for a cached page1 and the cached page is available to both serverA and serverB. in that case a request for page1 on serverB will return the cached version including links to wp-content/cache/autoptimize/css/autopitmize_A.css but serverB would not have that. but if page1 would only be in serverA’s cache, then on serverB both page1 and autopitmize_A.css would be (re-)generated.

    but when in doubt, sharing the AO-folder between servers might be the most fail-safe solution after all.

    happy holidays,
    frank

    Thread Starter theyuv

    (@theyuv)

    Thanks,

    As an alternative to sharing the AO folder, would the CDN option (ie: entering a CDN Url in the settings) provide the same (“most fail-safe”) solution (since the AO files will be stored in a central location)?

    It just seems like the CDN option might be easier to implement than sharing the AO folder mysql (eg: on an S3 bucket).

    On second thought, the CDN probably wouldn’t solve the issue because it would still be pulling the files from a single (arbitrary) server…

    Another update: Making the load balancer “sticky” should also fix the issue right?

    Happy holidays to you too. Thanks for your fast responses.

    • This reply was modified 8 years, 2 months ago by theyuv. Reason: Added comment
    • This reply was modified 8 years, 2 months ago by theyuv.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Running behind load balancer’ is closed to new replies.