Windows Azure provides a rich platform with adequate
built-in features for failover and load balancing. For instance, when you develop a Web Role,
you can deploy multiple load-balanced instances of the Web Role for high
availability. On top of that, you can
create policies in Traffic Manager to manage routing of incoming user requests
so they will be routed to the Web Role located in the closest data center. Combining the built-in load-balancing feature
with the Traffic Manager policies, you can develop a world-class geographical
failover solution very quickly. Let’s
get started on how you can do that.
Prerequisites
1.
Visual Studio 2010
2.
Windows Azure SDK (http://www.windowsazure.com/en-us/develop/net/)
3.
I assumed that you have the ability to create a
Web Role cloud application
Deploy Multiple Instances of the Web Role
Once you have the Web Role application, you can change the
instance count to 2 or more in ServiceConfiguration.Cloud.cscfg. The content would be something like this.
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="TestSQLAzureOData" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">
<Role name="WCFServiceWebRole1">
<Instances count="2" />
<ConfigurationSettings>
...
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="ABEE1F9453061DBAE8B364743736622639D12DCE" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
Next, you can deploy the Web Role via Visual Studio by
publishing it to Windows Azure or you can also create a package and deploy it
using the Windows Azure Portal (https://windows.azure.com). To publish to Windows Azure, click “Publish…” in the context menu in
Solution Explorer.

If you have not already created a hosted service, you will
need to create a hosted service located in a datacenter when you deploy the
service.
The next step is to deploy the Web Role to another hosted
service located in a different data center like so.

If the deployment is successful, we should now have 4
instances of the Web Role in two geographical datacenters that looks something
like this.

Create a Routing Policy
Now, we will create a routing policy using the Windows Azure
Traffic Manager. You will have a choice
of Performance, Failover, and Round Robin.
As discussed earlier, the Performance policy routes the users’ requests
to the nearest datacenter yielding the best performance from bandwidth
perspective and also provide the failover feature in case one datacenter is
down.

Once you created the Traffic Manager policy successfully,
your solution should now be complete.
The complete policy would look something like this.

Conclusion
Creating a geographical failover solution using the Windows Azure
platform can be accomplished with simple steps, but can provide a robust and
viable solution that would otherwise be very difficult and expensive to
accomplish.