Skip to main content

Traffic Manager (Day 7 of 31)

List of all posts from this series: http://vunvulearadu.blogspot.ro/2014/11/azure-blog-post-marathon-is-ready-to.html

Short Description
Traffic Manager allow us to distributed traffic to different endpoints. Endpoints can be on different datacenters. From some perspectives we can look at Traffic Manager like a Load Balancer at global level. In this way we can deploy a solution to multiple datacenters and redirect traffic based on user location


Main Features
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.
Configuration Tools
We can configure it using Power Shell, REST API or Management Portal. All the features are available from each tool.
DNS TTL
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

Endpoints Weight
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.
Profiles
A Traffic Manager profile represent all the configuration for a specific node.
Nested Profiles
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).
Real DNS
Traffic Manager can be used by your own domain DNS. Your DNS needs to point to Traffic Manager DNS.
Endpoints location
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.
Automatic Failover
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).

Limitations 
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)
Monitor Configuration
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’.

Code Sample 
 There is no custom code that you need to write when using Traffic Manager

Pros and Cons 
Pros

  • Simple to use
  • Different load balancing methods
  • DNS TTL

Cons

  • Cannot specify external endpoints
  • Cannot specify endpoints from different subscriptions
  • One point of failure if Traffic is down


Pricing 
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

Conclusion
Traffic Manager can be the feature that can make a real difference when you are working on a system that needs to be scalable, redundant and ready to face any kind of out stage. Yes, if Traffic Manager is down your system will be down, but Traffic Manager is running on all datacenters around the globe.

Comments

Popular posts from this blog

Windows Docker Containers can make WIN32 API calls, use COM and ASP.NET WebForms

After the last post , I received two interesting questions related to Docker and Windows. People were interested if we do Win32 API calls from a Docker container and if there is support for COM. WIN32 Support To test calls to WIN32 API, let’s try to populate SYSTEM_INFO class. [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO { public uint dwOemId; public uint dwPageSize; public uint lpMinimumApplicationAddress; public uint lpMaximumApplicationAddress; public uint dwActiveProcessorMask; public uint dwNumberOfProcessors; public uint dwProcessorType; public uint dwAllocationGranularity; public uint dwProcessorLevel; public uint dwProcessorRevision; } ... [DllImport("kernel32")] static extern void GetSystemInfo(ref SYSTEM_INFO pSI); ... SYSTEM_INFO pSI = new SYSTEM_INFO(

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine: threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration: TeamCity .NET 4.51 EF 6.0.2 VS2013 It see

Navigating Cloud Strategy after Azure Central US Region Outage

 Looking back, July 19, 2024, was challenging for customers using Microsoft Azure or Windows machines. Two major outages affected customers using CrowdStrike Falcon or Microsoft Azure computation resources in the Central US. These two outages affected many people and put many businesses on pause for a few hours or even days. The overlap of these two issues was a nightmare for travellers. In addition to blue screens in the airport terminals, they could not get additional information from the airport website, airline personnel, or the support line because they were affected by the outage in the Central US region or the CrowdStrike outage.   But what happened in reality? A faulty CrowdStrike update affected Windows computers globally, from airports and healthcare to small businesses, affecting over 8.5m computers. Even if the Falson Sensor software defect was identified and a fix deployed shortly after, the recovery took longer. In parallel with CrowdStrike, Microsoft provided a too