Microsoft Azure requires that applications utilize two instances across multiple data centers in order to achieve their "high availability" SLA and ensure your sites don't go down for routine maintenance. They even tell you which pairs of data centers will never go for maintenance at the same time.

That's all well and good but how would you do this easily in practice for an app like WordPress with a MySQL database on the same VM? I'm no stranger to load balancing between two VMs but the database replication setup eludes me. We wouldn't want two versions of the data that could get out of sync. MySQL replication seems to require a master-slave setup which would fail to sync changes to the master DB if a user landed on the slave instance.

Am I just misunderstanding this concept? Any help is much appreciated!

  • 1
    Why would you host WordPress on Azure? There are better and cheaper hosting for WordPress. Digital Ocean for example.
    – Alexus
    Commented Jul 13, 2015 at 20:20
  • 1
    Alexus, that's not really relevant here but we have a rather large stack spread across Azure's infrastructure of which WordPress is just one component. Azure is a fantastic platform and we're very happy with it.
    – Yaron
    Commented Jul 14, 2015 at 22:16
  • 1
    gotcha. You got to do what you got to do :) I also like Azure for most of my .NET stuff, but always hosted WP sites separately.
    – Alexus
    Commented Jul 14, 2015 at 22:51
  • Yaron, did you find the answer below helpful? It's received 3 upvotes so far, just wanted to check if you found any important concept missing so I can update to address it for your particular use case. Commented Aug 16, 2015 at 11:42
  • 1
    Thanks so much for the thorough answer @Bryan'BJ'Hoffpauir and sorry I haven't had the time to try following your instructions to see if they work with our implementation. I'm marking the answer as correct and will reach out again if I run into any trouble. Thanks again!!
    – Yaron
    Commented Aug 17, 2015 at 19:33

1 Answer 1


The Bad News: The core open source base of WordPress does make quite a few assumptions about being run on a single server (wp-content, user uploads and media library to name a few)

The Good News: Pretty much all cloud providers (including Azure) have abstractions that allow you to work around these design limitations.

Fundamentally, you'll be addressing the following concerns:

  • Load Balancing traffic between two (or more) "front-end" WordPress web / app servers. Not too difficult since WordPress is MOSTLY stateless unless you're letting users login to the sites. This is done via a combination of DNS and Load Balancers. You'll need support for 2 IPs for your app servers - 1 set will connect to the subnet that is routable via Internet (though hopefully protected by a firewall not outlined below) and the other two will be on a DIFFERENT subnet that is isolated from the other network and contains the Database Server Instances but basic outline is like such:
                     /-- ( - eth0) wp1.domain.com ( - eth2)
(Public IP) wp.domain.com          
                     \-- ( - eth1) wp2.domain.com ( - eth3)
  • Managing sessions IF you are letting users login to the sites. If so, you'll need to ensure when they login to server 1 that either all of their future requests get routed to that server (sticky sessions) or that it doesn't matter which server they access because sessions are managed via some other mechanism (via Zend Server Session Clustering, for example).

  • Managing Admin Logins IF you are letting some users login to the back-end to manage content (similar to above).

  • Choosing DB System that is ALSO Highly Available. No point in having two front end servers if your DB crashing brings the whole system down. You'll need to leverage MySQL Master / Slave replication via ClearDB or modify WordPress via plugin to leverage SQL Server so you can use its native clustering systems. This will mean you need at least 4 VM's if you want to manage the DB layer yourself (2 x App & 2 x DB). Here's how that might look:

               /-- wp1.domain.com (\---/( db1.domain.com (\
         wp.domain.com                        X                                      |           
               \-- wp2.domain.com (\( db2.domain.com (

  • NOTE - to ensure reliable failover & protect the security of the system, a THIRD network subnet is usually used to connect the two database nodes to each other via a private channel that is separated from the other communication networks that the app servers use to talk to the database & the app servers use to communicate with the outside world.
  • Enabling Connection Pooling to maximize performance and reliability of your app server's database connections.

  • Leveraging a Caching plugin like W3 Total Cache or Super Cache to minimize load on front end servers.

The Following guides offer specifics on how you can address each of the above challenges. There are several ways to handle each in Azure, so it's up to you to decide how you want to attack each challenge then deal with the constraints each of those choices imposes as you work up and down the stack.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.