What is Traffic Manager?
Traffic Manager is a service provided by Azure to balance the end user traffic load of services like web app, cloud service or VMs across multiple instances or endpoints, hosted in azure. It enables to define the routing policies for services hosted in Azure and traffic redirected according to the policies. It also improves the availability and performance of applications. Traffic manager is a DNS-based service; it is not a proxy or a gateway and does not see the traffic passing between the client and the service.
How Traffic Manager works?
Traffic Manager uses the Domain Name System (DNS) to direct client requests to the most appropriate endpoint based on a traffic-routing method and the health of the endpoints. Traffic Manager provides four traffic-routing methods to determine how users should be redirected to different instances or endpoints to suit different application needs and automatic failover. Traffic Manager is robust enough to handle failure across entire Azure regions.
Following are the routing methods supported by Traffic Manager
Priority: This routing method is used to set primary service endpoint for all traffic, and provide backups in case the primary endpoint is unavailable.
Weighted:This method is used to distribute traffic across set of endpoints according to weights, which you define.
Performance:This method is used to redirect end users to use the “closest” endpoint across globe in terms of the lowest network latency.
Geographic:Users are directed to specific endpoints based on which geographic location their DNS query originates from.
When to use Traffic Manager?
Consider a company which has global presence and want to create a web app to connect with all the global partners. The application need to be hosted in multiple regions of Azure and provide better performance and high availability to end users. In this scenario we need to use Traffic Manager to distribute client traffic to the closest available endpoint or instance.
Let’s take above example and see how we can use traffic manager.
- Deploy three instances of service in three different regions. The DNS names of these deployments are ‘mywebapp-us.azurewebsites.net’, ”mywebapp-eu.azurewebsites.net’, and ”mywebapp-asia.azurewebsites.net’.
- Create a Traffic Manager profile, named ‘mywebapp.trafficmanager.net’, and configure it to use the ‘Performance’ traffic-routing method across the three endpoints.
- Configure their main domain name, ‘partners.mywebapp.com’, to point to mywebapp.trafficmanager.net’, using a DNS CNAME record.
Following image illustrates how traffic manager works when end user sends request on a main domain which is mapped to traffic manager.
If user requests a page www.partners.mywebapp.com/login.aspx, following sequence of requests is followed to server the page.
- The client sends a request to its configured recursive DNS service to resolve the DNS name; it finds the name servers for the ‘mywebapp.com’ domain. It then contacts those name servers to request the ‘partners.mywebapp.com’ DNS record, it returns the CNAME record that points to mywebapp.trafficmanager.net.
- Recursive DNS service finds the name servers for the ‘trafficmanager.net’ domain, which are provided by the Azure Traffic Manager service. It then sends a request for the ‘mywebapp.trafficmanager.net’ DNS record to those DNS servers.
- The Traffic Manager Name servers receive the request. It choose an endpoint based on the traffic-routing method.
- The chosen endpoint is returned as another DNS CNAME record. In this case, let us suppose mywebapp-eu.azurewebsites.net is returned.
- Recursive DNS service finds the name servers for the azurewebsites.net domain. It contacts those name servers to request the ‘mywebapp-eu.azurewebsites.net’ DNS record. A DNS ‘A’ record containing the IP address of the eu-based service endpoint is returned.
- The recursive DNS service consolidates the results and returns a single DNS response to the client.
- The client receives the DNS results and connects to the given IP address. The client connects to the application service endpoint directly, not through Traffic Manager. Since it is an HTTPS endpoint, the client performs the necessary SSL/TLS handshake, and then makes an HTTP GET request for the ‘/login.aspx’ page.
Why use Traffic Manager?
Traffic Manager delivers high availability for applications by monitoring endpoints and providing automatic fail-over when an endpoint goes down.
Azure allows to run cloud services or websites in data-centers located around the world. Traffic Manager improves application responsiveness by directing traffic to the endpoint with the lowest network latency for the client.
Maintenance without downtime
Traffic Manager directs traffic to alternative endpoints while the maintenance is in progress.
Hybrid cloud deployments
Traffic Manager support external, non-Azure endpoints enabling it to be used with hybrid cloud and on-premises deployments.
Check Articles From Categories Health and Parenting Inspiring Stories Technology Microsoft Azure SharePoint O365