We setup a wordpress environment on 4 IIS servers. We're considering using a scheduled task triggering a robocopy script to replicate the wordpress directory every 5 minutes.

What are the opinions on such an approach ? Has anyone ever used this or similar ?

  • What are the 4 IIS server phyical or VM? What are you replicating the data or the databases and configs? Not sure why you would have 4 server 1 being a master (i am assuming ) and the others being passive if you are trying to achive HA that will not work. – Anthony Fornito Nov 8 '16 at 16:53
  • 1
    second question ( and probably most important ) why are you running wordpress on windows? – Anthony Fornito Nov 8 '16 at 16:55
  • Thanks @AnthonyFornito for your reply. Running wordpress on windows for internal reasons. I'm just trying to work with it. I am after replication of the website files (Database replication is already handled through MYSQL). The Front ends are VMs on Azure. I am mainly after a solution where all front ends share the same website files. Is there anything you would suggest ? – joebegborg07 Nov 8 '16 at 21:39

Having 4 front end servers that share the same files at the same time and each is able to write without using some kind of DFS or third party program dedicated to directory synchronization would be a night mare.

With azure you can looking into 3 things.

  1. Shared storage, there might be some cost associated with getting your own dedicated storage, and I am not sure of the configuration however Azure does offer this. This would ensure all you files are available to each server as soon as they are written.

  2. Azure DFS, DFS is a windows based directory synchronization tool that works rather well, also not sure about cost but the configuration might be a little easier. DFS does work asynchronously so there is a little delay but not not much.

  3. (Im going to explain how this would be done and then never talk about it again, because it is a horrible idea and will fail.) Create a script that will first compare the data on all four servers then copy the differential data. You would need to shared out each directory to the one server running the script, setup permission so the server can read and write and then troubleshoot troubleshoot, troubleshoot.

Either option from above will do the job, if your job depends on this working I would recommend you stay away from option 3.

That being said, and you are not trying to spend any money, follow the steps below.

  1. look at a program called "free file sync". There are some really good features to the free version I believe there is a paid for version but im not sure of the enhancements you get. I have used it in a lot of my dev environments when trying to achieve something similar to what you are looking to do and was to lazy to setup DFS.

  2. Make only one server writable, this can be easily done by configuring a URI on each server that says if create article go to ServerA, or a URL rewrite in your web.config, or being that WordPress is php use:

    header('Location: http://myhost.com/mypage.php');

Each will take a little bit of coding and PHP, IIS knowledge.

  1. The really fun part, with ServerA being the author server (only writable server) how do we direct traffic to ServerB, ServerC, and ServerD for reading without a load balancer?

Short answer you can't, well thats not exactly true, I had a customer once that was adamant about not using a load balencer he was able through a series of powershell scripts to move a connection from one server to other based on the amount of worker processes on each box or something like that. Either way very hard to do and not worth the time and energy to put forth.

See if you cannot configure Network Load Balancing on the servers, It will require an additional IP but its only one DNS change and the traffic can be distributed for reading across the 3 servers.

Good luck!

  • Many thanks for your suggestions. The single central storage was a bottleneck for us as we had that setup before but wasn't coping with high traffic. We needed a quick solution due to a deadline. We ultimately used resilio which is a peer-to-peer real-time syncing solution, which detects changes on any of the servers and replicates to the other server. I hope anyone having the same or similar issues could have this solve the problems the same way it did for us. I be testing your suggestion of URL re-writes for WP backend and pushing changes to other machines. Thanks Again. – joebegborg07 Nov 14 '16 at 9:30
  • NLB doesn't work on Azure (there's no layer 2, if you want some truly horrible nightmares just try to look at the ARP table on an Azure VM). – Massimo Dec 13 '17 at 18:24

Thanks for all the suggestions people.

Our solution was using a peer-to-peer synchronization approach using a tool called resilio.

Resilio allowed us to configure a number of computers (in this case IIS Front ends) in a peer-to-peer synchronization cluster. A folder is selected from each computer in the cluster to be used for the synchronization process.

The resilio service (windows service running in the background), monitors these folders for any changes and if a change is made to any of the specified folders on the front ends in question, resilio will push that change to the other servers.

I hope this can help others facing a similar problem in the future.


I don't think scheduled tasks and Robocopy is a great approach. Because of the 5 minute window there will be times where a resource is requested but the server selected by the load balancer won't have it available. For largely static sites this will happen much less often than with busy sites frequently changed. A higher frequency or using a different sync technology like Bittorrent Sync (now called Resilio Sync) would improve this quite a bit, but not eliminate the problem.

Putting your wp-content or maybe just the wp-content/uploads folder onto a shared drive would be a better solution. Another way to look at this would be to have one of the servers host that folder, and have the others share it. With disk caching the load on the server shouldn't be all that much higher than the other servers.


Have a look at this article for ideas about page caching, and this one for CDN. It's about Nginx so you'll need to work it out for IIS, but the theory behind it is valid for any web server.

  • Thanks for your suggestion @Tim. As you said the website is dynamic, with regular minor file updates due to wordpress plugins in place; That means every front end might have different files at times. Have you ever tested such production environment (approx. 500 - 1000 concurrent users); i.e. storing the website files in a central repository and mapped through a shared drive ? If yes how was the experience. – joebegborg07 Nov 8 '16 at 21:37
  • No I haven't tested that scenario - I don't need to because I cache and use a CDN. You would need to load test the front end servers including the back end file server. However if your pages aren't cutomised for each user page caching could massively reduce your load, as would using a content distribution - CloudFlare has a free tier. This is true even if you update every 5 minutes. Google "Nginx Microcaching" for the theory behind it, but you'll obviously have to implement it differently on IIS. Caching headers are pretty critical if you go this route. See update above too. – Tim Nov 8 '16 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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