Azure supports 6 different azure traffic manager routing methods to help provide load balancing to your endpoints inside or outside of azure. The routing methods help determine which endpoint will be returned in the DNS response. The six different azure traffic manager routing methods well discuss are:
- Priority: This method chooses a priority endpoint for all the traffic. Multiple backup endpoints can be provided if the primary goes down
- Weighted: Weighted allows for you to set weights on each endpoint to distribute based on the weight or evenly by setting each to the same weight.
- Performance: Best for endpoints in different geographic locations for end user latency performance
- Geographic: This option is great for localization, data sovereignty mandates to direct users to specific endpoints based on where the dns query originates
- Multivalue: For profiles where you can only have ipv4 or ipv6 addresses as endpoints
- Subnet: Allows you to map sets of end user ip address ranges to a specific endpoint
A traffic manager profile can only have one routing method assigned to it. For more complex scenarios you can nest traffic profiles together to allow for more different routing configurations.
Priority Azure Traffic Manager Routing Method
When looking to provide reliability to to a web server, a company will deploy 2 web servers. The priority routing method fails over to the secondary if the primary fails. First you configure the endpoints with a priority number. 1 being the highest priority. From the users perspective this method works by:
- A user sends a dns request through their browser
- The dns server sends a request to the azure traffic manager. Usually in this format <name>.trafficmanager.net. This name must be unique across the internet
- Traffic manager sends a dns response back to the original recursive dns server to send to the clients browser.
- The client then connects directly to the endpoint. Traffic does not go back through the traffic manager.
All the endpoints have health checks that check to make sure the traffic manager is still available. This method will put a lot of resources on 1 endpoint so sizing matters. Priority values must be between 1 an 1000. This is optional as well and a default value will be used.
Azure Traffic Manager Weighted Routing
Weighted routing allows for your to choose which available endpoints to send traffic to. Using integers from 1 to 1000 with 1 being the highest weight. As dns queries come in, traffic will be sent to the endpoint with the highest weight. If the weights are all the same then traffic will be evenly dispersed.
If the weight is staggered, then traffic will go to other endpoints more or less frequently. This works just like priority routing method in the sense:
- A user sends a dns request through their browser
- The dns server sends a request to the azure traffic manager to find the best weighted endpoint. In the same format <name>.trafficmanager.net. This name again must be unique across the internet
- Traffic manager sends a dns response back to the original recursive dns server to send to the clients browser.
- The client then connects directly to the endpoint based off weight. Highest weight will get most of the traffic. Traffic does not go back through the traffic manager.
This Azure Traffic Manager Routing Method has some useful use cases:
- The ability to upgrade applications gradually by slowly moving traffic over to a new endpoint
- Migrate endpoints that dont live in azure slowly into azure since you can use azure traffic manager for any endpoint
- Quickly scale dns request to more endpoints for bursting traffic
Dns caching can have an effect on weighted traffic distributions since clients may continue to connect back to endpoints more frequently after a change is made.
Performance Routing Azure Traffic Manager Method
Azure gives you the flexibility to deploy resources all across the globe. If you have 1 endpoint in the east region and the other in the west region, latency will determine which endpoint you connect to. Traffic maintains a latency table to be able to tell the latency between ip addresses and azure data centers.
Traffic manager does not get its request directly from users so latency it is determined by the request from the recursive dns service. If endpoints are deployed in the same region, then they will evenly get distributed traffic. With the performance azure traffic manager routing method a couple things to note:
- If all endpoints fail in a region then the traffic will go to the next closest region.
- When using endpoints outside of azure, then you will need to specify where those endpoints live.
- As users travel or internet latency tables are updated, performance routing method does not guarantee users will be routed to the same endpoint
Geographic azure traffic manager routing method
Geographic traffic manager profiles allow for you to route traffic based off the geographic location that the query originates from. This method allows you to control data compliance, and provide a better user experience with localization of content. When creating your endpoints, your geographic regions are broken down of:
- The World which could be any region or country
- Regional Grouping such as Africa, North American, Europe, etc…
- Then you pick your Country/Region such as United States, Canada, etc…
- And Lastly the State/Province.
Traffic manager uses the source ip address of the dns query to help determine where the query is coming. Each region can only be mapped to one endpoint in the geographic azure traffic manager routing method. For this reason its recommended to also use the nested type endpoints that have child profiles.
As you can see in the image above, the user gets routed directly to the endpoint based off the assigned geographical region. The nested profile gives you the redundancy of 2 endpoints.
MultiValue Routing Method
The multivalue routing method is a good choice when you want to limit the amount of dns queries the client has to send. This is achieved by sending multiple ipv4 endpoint values back in 1 dns request. This allows for multiple retries in the event and endpoint is unresponsive.
This method works only for endpoint types of type “External”. The max ipv4 or ipv6 addresses that can be sent are 10. This method also works well when you have a dual-homed endpoint. You then give the client the option to choose between ipv4 or ipv6.
Subnet Routing Method
The subnet routing method gives you the flexibility to route users based off the source ip of their dns request. There are a couple different scenarios using the subnet routing method makes sense:
- Route users from your corporate office to a specific endpoint.
- The ability to block request based on specific internet providers
Conclusion
As explained in this post, Azure traffic manager does not receive dns request directly from clients. Rather this is done by the recursive dns services like google, cloudflare, your isp, etc. All the routing methods have many use cases and choosing the correct one will depend on the scalability and uptime requirements of your applications.