In this post, I will explain several ways that you can use Traffic Manager, Azure’s website redirection solution, that enables high availability, fault tolerance, and more between different application deployments.
Traffic Manager is a DNS-based redirection solution for endpoints. An endpoint is any public IP address that has a DNS name. Note that simple definition includes DNS-configure public IP addresses in Azure but also endpoints anywhere else, such as on-premises, AWS, Google Compute, GoDaddy, or anywhere else that you can host a web application with an IP address/DNS name combination.
The system is pretty simple:
For example, www.joeelway.com (CNAME pointing to joeelway.trafficmanager.net) will resolve to my traffic manager profile, which in turn will resolve to the IP address/name of an endpoint depending on the selected routing method.
There are 4 possible routing methods:
Those are all simple scenarios but in this post, I want to focus on some other concepts.
Remember, the endpoints that Traffic Manager don’t need to be in Azure. I know one Microsoft partner that uses Traffic Manager with a customer that has no other services running Azure. It only uses Traffic Manager to redirect to services hosted elsewhere. That partner once told me that the Azure bill was so small every month, it would cost them money to charge the customer!
In a simple sense, both of these scenarios are identical. At one point in time, a website is running somewhere, such as on-premises, and later (planned or unplanned), it is running somewhere else such as Azure or another data center.
In these two scenarios, create a Traffic Manager profile with all traffic going to your production system. In the case of a migration, you can build up the new version of the system in the new location and test it independently of production.
When a disaster happens, you can modify the Traffic Manager profile to redirect to the failed over system. This could be the last step (Azure Automation runbook) in a recovery plan to failover to Azure or to another Azure region.
In a migration scenario, such as migrating to Azure, once all tests are signed off, you can switch users over to the new system by modifying the Traffic Manager profile. If you need to do a rollback, the change is simple: modify the Traffic Manager profile.
This scenario, similar in construction to above, was recently discussed by Microsoft in a blog post. Instead of a location migration, there is a simple change of endpoint to enable application upgrades. There are two implementations of the code, each with its own endpoint. Traffic Manager redirects to the old version of the code.
When testing has completed on the new version, there are a couple of strategies that you could use:
This solution provides a business with a safe way to switch between different versions of code. This is especially true if there are drastic changes, such as a switch from co-location hosting to Azure or a switch from Azure virtual machines to Azure App Services.
A Traffic Manager profile can use other Traffic Manager profiles as endpoints. This opens up some interesting scenarios. A “simple” one is illustrated below.
In this example, a global web application is shared using a single CNAME record that redirects to a top-level Traffic Manager profile. The illustration shows that the top layer redirects to two regional Traffic Manager profiles in Europe and the USA but this could scale out to many continents/countries. The top layer can achieve this redirection based on country or performance. The latter might be more successful if there are not country-specific requirements.
Within the European Traffic Manager profile, clients are sent to one of two deployments. I could have added UK/France regions here too or even non-Azure locations. Traffic is being sent either to North Europe or West Europe. The choice depends on whether you want active/active (weight-based) or disaster recovery (priority) deployments. The same solution is also deployed in the US regions.
We could make this a more complex deployment too. We could add the blue-green approach to each installation, adding a third layer.