Used only as DNS Resolver
Traffic Manager is used only to resolve the endpoint address. Once the endpoint is resolved, the request will go directly to the endpoint and will not pass through traffic manager.
Traffic Manager DNS Name
Each Traffic Manager instance will has his own DNS name. We will register this DNS in behind our real DNS if we want to redirect traffic from our site (www.foo.com) through Traffic Manger.
We can configure it using Power Shell, REST API or Management Portal. All the features are available from each tool.
We can specify how long the name of the DNS that is resolved by Traffic Manager will be cached by our clients.
Load Balancing Method
There are 3 types of load balancing supported in this moment:
- Performance – Based on performance and the load of each endpoint (based on latency)
- Round Robin – Traffic is redirect to all endpoints in a balanced way (first request goes to endpoint 1, second to endpoint 2 and so on)
- Failover – When the first endpoint is down, traffic is redirected to the second endpoint (and so on). We can specify the failover order
Each endpoint can have a specific weight that will be used by Traffic Manager for traffic distribution. Bigger values means that that endpoint can receive more traffic. It is used by Round Robin load balancing methods (this can be configured only from PowerShell or REST API).
Custom monitor endpoint
Traffic Manager allow us to specify what endpoint to monitor. We can use use HTTP/HTTPS endpoints. We can also specify a custom port and path. For all endpoints, the same monitor endpoint will be used.
A Traffic Manager profile represent all the configuration for a specific node.
Traffic Manager allow us to specify another traffic endpoint. In this way we can define complex failover profiles and we can manage different load balancing rules.
How does it works
Traffic Manager checks at a specific time interval if endpoint status. If 4 times in a row the endpoint is down, the endpoint will be marked as down and traffic will not be redirected anymore to that endpoint. Users that already know about that endpoint will still try to connect to that endpoint until the DNS cache expires (DNS TTL).
Traffic Manager can be used by your own domain DNS. Your DNS needs to point to Traffic Manager DNS.
All endpoints needs to be from the same subscription. You cannot use it with external endpoints.
Redirect user base on location
Users will be redirected to the closer endpoint. In this way clients can reach the endpoint that is in the best shape and is the most close to them.
Traffic Manager is able automatically to switch to another endpoint when the original one is down.
Test new deployments
We can very easily add endpoint with different configuration or different version of our application and check the behavior of them (testing the surface with new features).
Reduce Application Downtime
Traffic Manager allow us to switch automatically to a healthy endpoint if the original one is down.
Distribute traffic on multiple locations
Being able to register multiple endpoint from different datacenters, the traffic will be distributed to the closest endpoint (based on response time or other configuration – depending on what load balancing method we seleted).
Not all Azure Services Supported
You cannot include in Traffic Manager services like Service Bus, SQL Azure or Storage. In general you don’t want to do something like this.
External Endpoints are not supported
You are not allowed to monitor external endpoints (from on-premises or from other Azure Subscriptions)
You don’t have access to monitor configuration. Clients cannot configure how often the health of endpoints is checked.
Applicable Use Cases
Next, you can find 3 use cases where I would use Traffic Manager.
Web Sites deployed in multiple data centers
If you have a web sites that is deployed in multiple data centers, that the load balancing of traffic can be made easily using Traffic Manager. If the load of a web sites increase or is down the traffic will be redirected automatically to another endpoint.
Uniform load distribution
When you have a system that is distributes in different data centers and you have a custom rule to specify if an endpoint can accept new clients or not you can use Traffic Manager with success. You should implement the url path that is used to check the endpoint health to return a HTTP error code different from 200 OK if the current endpoint cannot accept new clients anymore.
Web sites failover
You can use traffic manager only as a failover mechanism for your web sites and configure the last failover endpoint from Traffic Manager to return only a simple HTTP page. In this way even if your system is down clients will be able to see something ‘nice’.
There is no custom code that you need to write when using Traffic Manager
Pros and Cons
- Simple to use
- Different load balancing methods
- DNS TTL
- Cannot specify external endpoints
- Cannot specify endpoints from different subscriptions
- One point of failure if Traffic is down
When you calculate the cost of using Traffic Manager in your system you should take into account:
The number of DNS queries to traffic manager