Introduction to Windows Azure Traffic Manager

Introduction
In my previous post, I spoke about business continuity with Windows Azure platform, you can read this blog here -

In this post I will try to explain how to achieve load balancing capabilities for application hosted in multiple Azure datacentres using Azure Traffic Manager.

What is Azure Traffic Manager?
According to the Microsoft Developer Network Platform (MSDN) definition, “The Windows Azure Traffic Manager allows you to control the distribution of user traffic to Windows Azure hosted services. The hosted services can be running in the same data centre or in different centres across the world. Traffic Manager works by applying an intelligent policy engine to the Domain Name Service (DNS) queries on your domain name(s).”

In a nutshell, Azure Traffic Manager could be treated as a network load balancer supporting traffic management for hosted services on Windows Azure.

Why do we need Azure Traffic Manager?
As stated in my previous post, in order to provide multiple 9′s of availability, it is important that the applications have multiple presences on multiple locations. There are various mechanisms for supporting multiple presence of the application. Some of the options are;
1. Multiple presences on a single server
2. Multiple presences on multiple servers in a single data centre
3. Multiple presence on multiple servers in multiple locations/ data centres

Azure Traffic Manager provides the means by which requests for application hosted in multiple Azure datacentres are handled or directed.

The diagram below represents a scenario where the same service is deployed in three Azure datacentres across the globe which is being accessed by Azure Traffic Manager.

Windows Azure Traffic Manager provides load balancing / traffic management feature for the hosted services. The Azure Traffic Manager could be used to implement Disaster Recovery (DR) configuration for the application. The windows azure Traffic Manager could be configured in the following ways:
1. Performance
2. Failover
3. Round-robin

What are the various configuration mechanisms?
Azure Traffic Manager comprises of multiple configurable entities as follows:
1. Hosted services: In order to use the Azure Traffic Manager you would need at least two hosted services in your subscription. These hosted services could be deployed on the same datacentre aka affinity group or in different data centres.
2. Policy type: The next configuration element required is the type of policy to be used by the Traffic Manager. Currently, there are 3 types of supported policy in Traffic Manager:

  • a. Performance (I call it as nearest node and I would explain why)
  • b. Failover
  • c. Round-Robin

3. Monitoring page: The other important configuration element is the monitoring page. In order for the Traffic Manager to monitor the health of the hosted services, a monitoring page is required to be provided in the hosted service. The monitoring page should implement any logic to access the health of the hosted service. The Traffic Manager merely attempts to access the page and records the Http response status and the time taken as the means to identify the status of the services.
4. DNS information: The final configuration for the Traffic Manager is the DNS configuration for the Traffic Manager. The DNS configuration contains the single dns name for the hosted services and the TTL for DNS.

How does Windows Azure Traffic Manager works?

The Traffic Manager works on the basic principle that an application hosted in the multiple hosted services would be available for load balancing. Azure Traffic Manager provides a single DNS name for accessing the hosted services. The required hosted services are all grouped and a single DNS name is assigned for the services with a policy which determines how the Traffic Manager would retrieve the DNS name for the hosted service for the next request.

When an end-user calls the Traffic Manager’s DNS name for the services, the Traffic Manager evaluates the policy file to identify the DNS name for the hosted service which would be used to handle the request. Upon identification, the Traffic Manager sends the DNS name of the identified hosted service. The client then uses the identified DNS for interacting with the hosted service.

1. User traffic to the Traffic Manager: The user requests for the application by using the Traffic Manager DNS name. Generally, the domain name / DNS name for the Traffic Manager would be yourapplicationname.trafficmanager.net.
2. Traffic Manager and policy: The Traffic Manager domain is part of the Traffic Manager policy. Traffic enters through the domain. The policy dictates how to route that traffic. The Traffic Manager policy uses the chosen load balance method and monitoring status to determine which Windows Azure hosted service should service the request.
3. Hosted URL to the User: Traffic Manager returns the DNS Name of the hosted service to the IP address of a chosen hosted service to the user. The user’s Local DNS resolver resolves the domain to the IP address of a chosen hosted service.
4. User requests the application: The user calls the chosen hosted service directly using the returned IP address.

The client resolver in Windows caches DNS host entries for the duration of their time-to-live (TTL), the user continues to interact with the chosen hosted service until its local DNS cache expires for the subsequent requests. The mechanism creates an interesting scenario; let’s assume that the cached hosted service becomes unavailable during the DNS TTL period. So in this case the client retrieves the host entries from the cache which bypasses the policy and therefore could possibly result in unexpected behaviour. Additionally, if the TTL of a DNS host entry in the cache expires, new requests for the same host name should result in the client resolver executing a fresh DNS query. However, browsers typically cache these entries for longer periods, even after their TTL has expired.

To reflect the behaviour of a Traffic Manager policy accurately when accessing the application through a browser, it is necessary to force the browser to clear its DNS cache before each request. Believe me this has caught me few times, especially during client demos.

Traffic Manager monitors the state of the hosted services in your policies and will not send traffic to those it sees as down. If all hosted services in the policy are detected to be offline, Traffic Manager acts as if all hosted services in the policy are actually online so it will at least resolve the DNS name to an IP address, even though the client computer will call a hosted service that may not respond. For more information about how hosted services are monitored, see Monitoring hosted services in Windows Azure Traffic Manager.

Load balancing mechanisms
One of the key fundamentals in Azure Traffic Manager is Traffic Manager Policy. The Traffic Manager policy dictates the rules for identifying the hosted service. So it’s very important to explore the policy in detail. The next section describes the policy configurations for Azure Traffic Manager.

Performance based load balancing method
In performance based load balancing method the originating traffic is routed to the closest hosted service. The word performance here refers to performance with respect to round trip time between the originating IP and Azure datacentres. Currently, this method does not consider performance or load on the hosted services. Therefore to avoid confusion I have termed this method as the “Nearest Node” method. The “Closeness” of the node/hosted service is basically determined by a network performance matrix containing routing information various IP addresses/ranges and each Windows Azure datacentre. The network performance matrix does not represent the real time performance; rather it is updated regularly based on historic data. Therefore under certain circumstances the results might vary.

The following graphic shows the general process for the Performance load balancing method.

The following numbered steps correspond to the numbers in the diagram.

1. The initial step is to build the network performance matrix in the Azure Platform. The Azure Traffic Manager infrastructure runs tests to determine the round trip times between different points in the world and the Windows Azure datacentres which run hosted services. These results are updated in the network performance matrix for identifying the most optimum route for different points in the world.

2. The Traffic Manager domain receives an incoming request from a client machine.

3. Traffic Manager refers the network performance matrix to determine the round trip time between the location of the incoming request and the hosted services configured in the Traffic Manager. Traffic Manager uses the best time to determine the location of the hosted service. In this case the Traffic Manager selects hosted service 1 for the request.

4. Traffic Manager returns DNS name of the selected hosted service to the client machine.

5. The client machine resolves the DNS name to the IP address and calls the hosted service.

Failover based load balancing method
In failover load balancing method, the Traffic Manager selects the first available hosted service from the configured list of the hosted services. The first available hosted service is marked as primary/active hosted service and the others as live but passive hosted service. If the current primary hosted service is detected to be offline, the Traffic Manager then routes the traffic to the next hosted service in the configuration list and marks it as primary/ active hosted service. The Traffic Manager would always route all the requests to the primary hosted service. There could only be one primary hosted service at a time and remains primary unless the hosted service becomes unavailable upon which the next hosted service in the configuration list becomes primary. If all hosted services in the policy are offline, Traffic Manager returns the DNS name of the primary hosted service.

The following numbered steps correspond to the numbers in the diagram.

1. The Traffic Manager domain receives an incoming request from a client machine.

2. Azure Traffic Manager Policy contains the list of hosted services configured for the load balancer. Traffic Manager checks if the first hosted service in the list is available. If the first hosted service is unavailable, it proceeds to the next available hosted service. In this case the Traffic Manager selects hosted service 2.

3. Traffic Manager returns the DNS entry of the primary hosted service to the client machine.

4. The client machine calls primary hosted service.

Round Robin load balancing method

In Round Robin method, the Traffic Manager distributes the traffic across the hosted services configured in the Traffic Manager. The Traffic Manager keeps track of the last hosted service that received traffic and sends traffic to the next one in the list of hosted services. The Traffic Manager would not send traffic to hosted service which is marked as unavailable/down.


The following numbered steps correspond to the numbers in the diagram.

1. The Traffic Manager domain receives an incoming request from a client machine.

2. Azure Traffic Manager Policy contains the list of hosted services configured for the load balancer. Traffic Manager knows which hosted service has received the last request.

3. Traffic Manager returns the DNS entry of the next hosted service in the hosted service list to the client machine.

4. The Traffic Manager updates the record for last handled hosted service so that it knows which hosted service has handled the last traffic.

5. The client machine calls the hosted service.

Traffic Manager monitors the state of hosted services and will not send traffic to hosted services it thinks are unavailable. If all hosted services in the policy are unavailable, Traffic Manager acts as if all hosted services in the policy are actually available so it will at least resolve the DNS name to an IP address, even though the client machine will call a hosted service that may not respond.

Note: Please note that clients will continue to use a given hosted service until its local DNS cache expires. So if you are planning to test the policy from a single client, you need to ensure that the DNS name is resolved for each request to observe the round robin behaviour.

With Windows Azure Traffic Manager you could now easily distribute and manage traffic to your application across the datacentres. Additionally, Azure Traffic Manager creates interesting scenarios like integrating with an existing on-premise datacentre for disaster recovery, load balancing, handling spike, etc.

For more information please email info@im-onlineservices.com or visit our website – www.im-onlineservices.com

Rahul Sur is a highly proficient and hands-on Technical Architect accomplished in designing and delivering complex and high profile IT solutions comprising middle-and-multi-tier software development across mobile, media, web and Cloud platforms using Microsoft technologies and a range of quality standards and project methodologies.

© 2012 Information Management Group Limited


About these ads

About IMGROUPonline
As one of Microsoft’s Gold Partners we are the recognised thought leaders and innovators in information management. We have one of the most experienced and highly skilled teams in the industry and have completed hundreds of successful information management projects in the private and public sectors. Our blogs will concentrate in all aspects of Business Intelligence, SharePoint, Relationship Management, Online Services, Infrastructure and Application Management.

One Response to Introduction to Windows Azure Traffic Manager

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 323 other followers

%d bloggers like this: