Title: Running behind load balancer
Last modified: November 15, 2016

---

# Running behind load balancer

 *  Resolved [theyuv](https://wordpress.org/support/users/theyuv/)
 * (@theyuv)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/running-behind-load-balancer/)
 * 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](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/running-behind-load-balancer/#post-8437671)
 * 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](https://wordpress.org/support/users/theyuv/)
 * (@theyuv)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/running-behind-load-balancer/#post-8437730)
 * 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](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/running-behind-load-balancer/#post-8437753)
 * 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](https://wordpress.org/support/users/theyuv/)
 * (@theyuv)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/running-behind-load-balancer/#post-8437793)
 * I don’t think my load balancer caches anything. I am using an Application Load
   Balancer ([https://aws.amazon.com/elasticloadbalancing/applicationloadbalancer/](https://aws.amazon.com/elasticloadbalancing/applicationloadbalancer/))
 * I’ll look into your suggestions. Thanks.
 *  Thread Starter [theyuv](https://wordpress.org/support/users/theyuv/)
 * (@theyuv)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/running-behind-load-balancer/#post-8584611)
 * 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](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/running-behind-load-balancer/#post-8584674)
 * 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](https://wordpress.org/support/users/theyuv/)
 * (@theyuv)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/running-behind-load-balancer/#post-8585441)
 * 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 9 years, 6 months ago by [theyuv](https://wordpress.org/support/users/theyuv/).
      Reason: Added comment
    -  This reply was modified 9 years, 6 months ago by [theyuv](https://wordpress.org/support/users/theyuv/).

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

The topic ‘Running behind load balancer’ 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/)

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)
 * [load balancer](https://wordpress.org/support/topic-tag/load-balancer/)

 * 7 replies
 * 2 participants
 * Last reply from: [theyuv](https://wordpress.org/support/users/theyuv/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/running-behind-load-balancer/#post-8585441)
 * Status: resolved