Title: Multi-server / Horizontal Scaling
Last modified: December 8, 2021

---

# Multi-server / Horizontal Scaling

 *  Resolved [George](https://wordpress.org/support/users/subscriptiongroup/)
 * (@subscriptiongroup)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/multi-server-horizontal-scaling/)
 * Hello,
 * This is similar to [https://wordpress.org/support/topic/multi-server-3/](https://wordpress.org/support/topic/multi-server-3/)
   which didn’t provide a solution.
 * We have multiple servers for the front-end sat behind a Load Balancer.
 * When customer X visits page Y the LB routes the traffic to web1. AO creates the
   necessary files and passes them to customer X.
 * The customer’s browser requests the merged/minified file from CDN and the CDN
   tries to get it from our LB. If the LB picks web2 to serve the file, the file
   doesn’t exist and a 404 is returned.
 * One solution is for servers to use common storage so everything inside /cache/
   autoptimize is shared between them and any server can serve a file created from
   another one.
 * Another solution is to somehow push the files to the CDN instead of have the 
   CDN pulling them from the server.
 * Another possible solution might be setting the CDN to have a fallback in case
   it gets a 404 from one server? This would require servers to respond to web1.
   site.com, web2.site.com etc so the CDN will be trying [http://www.site.com](http://www.site.com)
   and failing that, start trying web1, web2 etc.
 * Any other suggestions or preference between those approaches?

Viewing 1 replies (of 1 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/multi-server-horizontal-scaling/#post-15143239)
 * The easiest solution (assuming your CDN supports push) would indeed be to push
   any file in `wp-content/autoptimize/cache` to the CDN, but CDN-push is not something
   AO knows how to do so that gap will have to be bridged by something else (e.g.“
   WP Offload Media” mentioned in the other post maybe?).
 * Syncing between the different webs (either automatically through a shared mounted
   filesystem or using something like rsyncd) would obviously also work.
 * The CDN intelligently switching between webs in case of a 404 seems the least
   feasible as it depends on logic being implemented/ configured at CDN side.
 * hope this helps,
    frank

Viewing 1 replies (of 1 total)

The topic ‘Multi-server / Horizontal Scaling’ 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/)

 * 1 reply
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/multi-server-horizontal-scaling/#post-15143239)
 * Status: resolved