Setting up Load Balancing for Umbraco

The other day I was about to set up load balancing for Umbraco, according to this article it shouldn’t bee to hard, or so I thought…

My setup was going to be one server with database (MySQL) and Umbraco (ww01) and another server only running Umbraco (ww02). For starters everything worked on the single machine ww01, I could publish and see the new information.

I took all of my files from ww01 and put them on ww02, configured the IIS and I now had two load balanced servers, although with no publication to ww02.

Umbraco publishing

Ok next step, configuring Umbraco, this shouldn’t be to hard, I changed the “distibutedCall” to true in the file “config/umbracoSettings.config” and added my servers to the list on both servers. I tried to publish and now nothing worked, I couldn’t publish on either ww01 or ww02 and I got a lot of time-outs and other strange errors.

After a while we tried changing the setup, making ww02 publish to ww01, and this worked right away, very strange. However we needed ww01 to be the publishing server so we had to continue trying.

I wont go into details of all the things we tried before solving this, but finally we found that the problem was that “Network Service” didn’t have full rights to all of the files in IIS and when the permissions were fixed everything worked as a charm.

BTW a good way for finding errors in replication is to try to login to the webservices manually f.ex. http://server-1/umbraco/webservices/CacheRefresher.asmx and  http://server-2/umbraco/webservices/CacheRefresher.asmx from the server that should do the publishing. Both these services should be available from the publishing server.

File replication

Ok, next step was setting up file synchronization between the servers. If we add an image to the Media section on server ww01 we need to have it replicated to server ww02.

After trying for a couple of hours we gave up on the whole DFS-thing. We had a lot of warnings and errors when trying to add DFS Namespaces which are needed for replication of files between server.

Instead we found a simpler solution the Syncback freeware from 2BrightSparks. We shared the media folder on ww01 and attached it as a network drive on ww02 then we set up a synchronization with syncback and ran this and it worked. However when setting up a scheduled sync we failed again. Long story short, we were unable to set up any schedules for a non logged in user due to a local security policy setting in Microsoft Server 2008. The solution was found here by our old friend Google and a search for “Error 2147943712”.

In conclusion

Umbraco replication worked as a charm, all errors were due to microsoft policy settings or access restrictions. I feel very confident with adding a new server to the farm for better load balancing if needed in the future. One of the benefits of load balancing is that we can point the load balancer to one server while updating the other and vice-versa.