As organizations steadily and increasingly adopt public cloud solutions like Microsoft Azure to host their applications and infrastructure, eliminating single points of failure and providing the highest levels of availability for cloud-based applications and services remains a high priority, just as it does for on-premises implementations. Traditionally, network engineers might deploy Global Server Load Balancing (GSLB) solutions to provide high availability and redundancy for applications and services. In Microsoft Azure, Azure Traffic Manager performs a similar function. Azure Traffic Manager provides policy-based traffic distribution by responding to DNS queries for the Traffic Manager DNS name and returning the IP address of the best endpoint, based on the configured traffic profile. Azure Traffic Manager can be leveraged to provide essential redundancy for cloud-based, and even on-premises services. In this article I’ll demonstrate how to provide high availability for a group of web servers which are running as Azure virtual machines in three different regions.
Create an Azure Traffic Manager Profile
Begin by creating an Azure Traffic Manager Profile. In the Azure management portal, click Traffic Manager in the navigation pane and then click Create a Traffic Manager Profile.
Provide a DNS prefix to be used for the traffic manager profile and then select a Load Balancing Method. For the Load Balancing Method there are three options to choose from. They are:
- Performance – This load balancing method routes requests based on latency. In this mode, the endpoint with the lowest latency (quickest response time) will be selected. Typically this method is used to route client requests to the service endpoint located nearest them.
- Round Robin – This load balancing method routes requests in a round robin fashion. Typically this method is used when all endpoints are equal in performance. This option is useful when configuring traffic manager profiles for distributing requests for web sites or cloud services in different regions.
- Failover – This load balancing method sends all traffic to a primary endpoint when the primary endpoint is available. If the primary endpoint is not available, all requests will be delivered to a secondary endpoint. This option is useful when configuring traffic manager to use a secondary region as a stand by in the event the primary region is offline, either for planned or non-planned downtime.
Once you’ve selected a load balancing method, click Create to create the Azure Traffic Manager profile.
Adding Azure Traffic Manager Endpoints
Once the new Azure Traffic Manager Profile has been provisioned, click on the new Azure Traffic Manager profile, select the Endpoints tab, and then click Add Endpoints.
Select the appropriate Service Type from the drop-down list and add any endpoints you wish to include in this profile.
After the endpoints have been added, each endpoint will appear along with its DNS name, status, type, and location.
If at some point you wish to change the configuration settings for this traffic manager profile, click the Configure tab. Here you can alter the Time to Live (TTL) for the DNS name, alter the load balancing method, or change monitoring settings if necessary.
Configuring DNS (Optional)
While it is possible to access your application using the traffic manager DNS name, in this example richardhicks.cloudapp.net, often it is desirable (and certainly much more elegant!) to use your existing domain name to refer to the application. For example, I’d like to access this demonstration web application using the familiar hostname www.richardhicks.net. To accomplish this, create a CNAME record in DNS to resolves the name “www” to richardhicks.cloudapp.net. The record should appear as follows.
www.richardhicks.net IN CNAME richardhicks.cloudapp.net
Managing Azure Traffic Manager Endpoints
When and if the time comes to remove an endpoint from the traffic manager profile, for example as part of a planned outage to perform system maintenance or perhaps because of an unplanned outage, it is quick and simple to do this. For the traffic manager profile select the Endpoints tab, highlight an endpoint you wish to remove from service, and then click Disable at the bottom of the screen. Once the service has been performed or the issue resolved, simply highlight the endpoint once again and click Enable at the bottom of the screen to place the endpoint back in to service.
Advanced Traffic Manager Configuration
Azure Traffic Manager also supports some advanced capabilities that can only be configured via PowerShell or REST APIs. For more information regarding the installation and configuration of PowerShell for Azure, click here. For example, Azure Traffic Manager now includes support for weighted round robin, but this setting is not currently included in the Azure management portal GUI at the time of this writing. Hopefully it will be included in the near future. Using weighted round robin, administrators have much more granular control over how traffic is distributed between endpoints. A popular use case is to provide validation testing with metered amounts of traffic when bringing on additional endpoints.
Azure Traffic Manager also includes support for external endpoints. That’s right, you can now include endpoints that are not hosted in Azure at all in Azure Traffic Manager profiles. This feature can be used to provide additional redundancy and flexibility for endpoints by enabling failover to cloud or burst to cloud scenarios. Conversely, you could failover to an on-premises endpoint in the event an endpoint in the cloud becomes unavailable for any reason. Again, this can only be configured using PowerShell or REST APIs. These settings are not exposed via the GUI at this time. For more details about configuring these advanced Azure Traffic Manager settings, click here.
Azure Traffic Manager provides much needed resiliency for applications and services hosted in the Azure public cloud. Azure Traffic Manager can be configured to provide load distribution, based on latency or simple round robin, and can also provide fail over in the event of an outage. Azure Traffic Manager can be configured either with the GUI or PowerShell and REST APIs, and can be leveraged to eliminate single points of failure and intelligent network traffic distribution for endpoints located in different Azure regions. Advanced features include the ability to configure weighted round robin, providing additional granularity for traffic distribution. In addition, Azure Traffic Manager also provides supports for distributing network traffic to endpoints not hosted in Azure. These endpoints could be hosted in another public cloud provider or on premises.