Microsoft Azure Traffic Manager

Varratna Bondade
Globant
Published in
5 min readMar 11, 2021

--

What is Azure Traffic Manager:

  • Routes the traffic (request) from the client to the appropriate endpoint.
  • Endpoint is nothing but a service or apps running inside or outside Azure.
  • The Status of the Endpoint can be tracked (running, stopped, deleted) which is nothing but the health monitoring of the endpoint.
  • Azure Traffic Manager uses DNS to direct the request to the appropriate service endpoint based on various traffic routing methods.

Traffic Manager Features

High Availability of the application, by monitoring the endpoint and providing the automatic failover when the endpoint goes down.

Improved performance by redirecting the request to the endpoint with the lowest latency.

No Downtime, traffic manager can redirect the request to alternate endpoints while maintenance is in progress.

Azure Traffic Manager Profile

Traffic Manager Profile use traffic routing methods to control the distribution of traffic to your website endpoints. You can create Traffic Manager Profile using any of the methods — Portal, PowerShell, Azure CLI, ARM Templates.

Traffic Manager endpoints

Azure traffic manager allows you to control how network traffic is distributed to application deployments running in different datacenters. You can configure each application deployment as an ‘endpoint’ in traffic manager. When traffic manager receives the DNS request, it chooses available endpoint based on the health check or status and the routing method to return in the DNS response.

There are 3 types of endpoints supported by traffic manager

Azure endpoints- Used for services hosted in azure.

External endpoints- These services are on premises or with different hosting provider.

Nested endpoints- These are used to create more flexible traffic routing schemes to support the need of large and more complex deployments.

Configuring endpoint monitoring:

To configure endpoint monitoring, you must specify the following settings on your Traffic Manager profile:

  • Protocol- Choose HTTP, HTTPS, or TCP as the protocol that Traffic Manager uses when probing your endpoint to check its health
  • Port- Choose the port used for the request.
  • Path- This configuration setting is valid only for the HTTP and HTTPS protocols, for which specifying the path setting is required. Providing this setting for the TCP monitoring protocol results in an error. For HTTP and HTTPS protocol, give the relative path and the name of the webpage or the file that the monitoring accesses. A forward slash (/) is a valid entry for the relative path. This value implies that the file is in the root directory (default).
  • Probing Interval- This value specifies how often an endpoint is checked for its health from a Traffic Manager probing agent. You can specify two values here: 30 seconds (normal probing) and 10 seconds (fast probing). If no values are provided, the profile sets to a default value of 30 seconds. Visit the Traffic Manager Pricing page to learn more about fast probing pricing.
  • Tolerated Number of Failures- This value specifies how many failures a Traffic Manager probing agent tolerates before marking that endpoint as unhealthy. Its value can range between 0 and 9. A value of 0 means a single monitoring failure can cause that endpoint to be marked as unhealthy. If no value is specified, it uses the default value of 3.
  • Monitoring Timeout- This property specifies the amount of time the Traffic Manager probing agent should wait before considering that check a failure when a health check probe is sent to the endpoint. If the Probing Interval is set to 30 seconds, then you can set the Timeout value between 5 and 10 seconds. If no value is specified, it uses a default value of 10 seconds. If the Probing Interval is set to 10 seconds, then you can set the Timeout value between 5 and 9 seconds. If no Timeout value is specified, it uses a default value of 9 seconds.

How endpoint monitoring works:

If the monitoring protocol is set as HTTP or HTTPS, the Traffic Manager probing agent makes a GET request to the endpoint using the protocol, port, and relative path given. If it gets back a 200-OK response, then that endpoint is considered healthy.

If the monitoring protocol is TCP, the Traffic Manager probing agent initiates a TCP connection request using the port specified. If the endpoint responds to the request with a response to establish the connection, that health check is marked as a success and the Traffic Manager probing agent resets the TCP connection.

If the response is a different value for HTTP/HTTPS or TCP, or, if no response is received within the timeout period specified, then the Traffic Manager probing agent re-attempts according to the Tolerated Number of Failures setting (no re-attempts are done if this setting is 0). If the number of consecutive failures is higher than the Tolerated Number of Failures setting, then that endpoint is marked as unhealthy.

Traffic Manager routing Methods

Supports Six routing methods

Routing methods determine how to route the traffic to various service endpoints, also which endpoint to to be returned as a DNS response.

The following traffic routing methods are available in Traffic Manager

Routing Methods

How Azure traffic Manager works:

  1. Client request the site name portal.mywebsite.com. This request is sent to the configured recursive DNS service to resolve the name.
  2. To resolve the DNS name, the recursive DNS service finds the name servers for mywebsite.com domain. It then contacts the those name servers to request portal.mywesite.com DNS record. The “mywebsite.com” DNS servers returns the CName that points to mywebsite.trafficmanager.net
  3. The recursive DNS service finds the name servers for “trafficmanager.net” domain which is provided by Azure traffic manager service. It request mywebsite.trafficmanager.net DNS record to those DNS servers
  4. Traffic manger name servers receives the request and chooses the endpoint based on ,state of the each endpoint ,current health of each endpoint and the traffic routing method chosen.
  5. the selected endpoint mywebsite-eu.cloudapp.net is returned.
  6. The recursive DNS service finds name servers for the ‘cloudapp.net’ domain. It contacts those name servers to request the ‘mywebsite-eu.cloudapp.net’ DNS record A record containing the IP address of the EU based service endpoint is returned.
  7. The recursive DNS service consolidates the results and returns a single DNS response to the client.
  8. The Client receives the DNS results and connects to the given IP address.

--

--