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

How to check in AngularJS if a service was register or not

There are cases when you need to check in a service or a controller was register in AngularJS.
For example a valid use case is when you have the same implementation running on multiple application. In this case, you may want to intercept the HTTP provider and add a custom step there. This step don’t needs to run on all the application, only in the one where the service exist and register.
A solution for this case would be to have a flag in the configuration that specify this. In the core you would have an IF that would check the value of this flag.
Another solution is to check if a specific service was register in AngularJS or not. If the service was register that you would execute your own logic.
To check if a service was register or not in AngularJS container you need to call the ‘has’ method of ‘inhector’. It will return TRUE if the service was register.
if ($injector.has('httpInterceptorService')) { $httpProvider.interceptors.push('httpInterceptorService&#…

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.51EF 6.0.2VS2013
It seems that there …

Run native .NET application in Docker (.NET Framework 4.6.2)

Scope
The main scope of this post is to see how we can run a legacy application written in .NET Framework in Docker.

Context
First of all, let’s define what is a legacy application in our context. By a legacy application we understand an application that runs .NET Framework 3.5 or higher in a production environment where we don’t have any more the people or documentation that would help us to understand what is happening behind the scene.
In this scenarios, you might want to migrate the current solution from a standard environment to Docker. There are many advantages for such a migration, like:

Continuous DeploymentTestingIsolationSecurity at container levelVersioning ControlEnvironment Standardization
Until now, we didn’t had the possibility to run a .NET application in Docker. With .NET Core, there was support for .NET Core in Docker, but migration from a full .NET framework to .NET Core can be costly and even impossible. Not only because of lack of features, but also because once you…