Monday, June 16, 2014

Understanding Azure Traffic Manager for network traffic management


Before understanding Azure Traffic Manager let’s first understand terminologies that are used in Traffic Manager.
What is Domain Name System - DNS –?
Every web site hosted on server has a unique IP. It is very hard to remember the IP therefore user friendly name introduced. These are nothing but the Domain names. So DNs server internally converts user friendly names into IP address of a web site.
Hence Domain name is simply a unique name for your application by which it is known in the internet world. For example, Google.com is DNS name. In other words, we can call it as a unique name that is assigned to your web application.
What is Local DNS?
Local DNS server is nothing but the server of your Internet Service Provider by which you get internet access for your machine. If you are part of any organization and accessing the internet from organization network then your corporate network DNS will be your local DNS.
What is CNAME?
CNAME stands for Canonical Name. The dictionary meaning of Canonical is Authorized or Recognized.
CNAME is a type of record in the DNS used to specify that, domain name uses the IP address of another domain. For example, on Azure I created a cloud service and its DNS name will be http://kunalcloudservice.cloudapp.net

Let’s say I wish to change it to http://kunal.com so that I don’t want my customers to see cloudpp.net thing. Then I will configure CNAME or custom name for my cloud service DNS. So http://kunal.com will be my CNAME for cloud service DNS.
What is DNS Cache?
A DNS cache contains records that transform domain names to IP address. The internet domain name system involves caching on internet DNS server and on client machine which connects to DNS servers.
Why to use Azure Traffic Manager?




Let’s say I have created a cloud service in West Europe and my end users are not located in Europe region only however few of my users are also located in US and Asia region. If the users in Asia region try to access the cloud service then their request will be served from Europe region datacenter only. So there can be possibility that users in Asia will experience high latency, low responsiveness and hence low performance. In such situation I want my application to be served from nearest datacenter for Asia users. To serve this purpose we use Azure Traffic Manager.
What is Azure Traffic Manager?
Azure Traffic Manager controls the distribution of user traffic to specified endpoints. These endpoints can be azure web sites, azure cloud services or any other end points.
How Azure Traffic Manager Works?
Please refer to the following diagram –




The application, is deployed to 3 different cloud services in Azure and distributed across 3 different regions –
1.     Asia – http://kunalcloudservice2.cloudapp.net/

2.     Europe - http://kunalcloudservice1.cloudapp.net/

3.     Japan - http://kunalcloudservice3.cloudapp.net/

These cloud service URL’s are added as Endpoint in Azure Traffic manager from Azure Management Portal. The Traffic Manager URL is “kunaltrafficmgr.trafficmanager.net”. Now traffic manager URL is not user friendly therefore you can have custom domain name configured for traffic manager. Let’s say I have configured “www.kunalapplication.com” as custom domain name for traffic manager URL. So “www.kunalapplication.com” is nothing but the CNAME for traffic manager URL “kunaltrafficmgr.trafficmanager.net”.
User in Asia requests “www.kunalapplication.com”. These DNS name need to be ultimately resolved to nearest cloud service and its IP address.
This URL is mapped to traffic manager URL. Therefore Local DNS of user in Asia requests for Traffic Manager Domain name. Based on specified load balancing method and monitoring configuration, traffic manager automatically decides whether Asia or Europe or Japan region hosted application should serve the current request. In current example, user is from Asia region therefore, Traffic manager domain name gets mapped to Asia region hosted application for the current request and CNAME record along with IP address for Asia region hosted application endpoint “http://kunalcloudservice2.cloudapp.net” and is returned to user’s local DNS server.
The returned DNS name and IP is cached in DNS Cache. The DNS Time-to-Live (TTL) informs DNS clients and resolvers on DNS servers how long to cache the resolved names. Clients will continue to use a given endpoint when resolving its domain name until the local DNS cache entry for the name expires.
Decision of nearest datacenter of Azure depends on what?
The decision of closest azure regions is done based on location of user’s local DNs server and not based on physical location of user. Therefore if users in Asia are using a DNS server in the US, then those users will be served from US region endpoint event if they are located in Asia region physically. 


To configure Azure Traffic Manager with Performance load balancing refer to the link - http://sanganakauthority.blogspot.com/2014/06/performance-load-balancing-using-azure.html

Hope this helps.
Cheers…
Happy Traffic Management!!

2 comments:

  1. this is good basic info; what is the method of traffic manager figuring out where the local DNS is so it returns the appropriate "closest" DC?

    also minor correction in the sentence "So there can be possibility that users in Asia will experience low latency, low responsiveness and hence low performance" I believe you mean high latency and not low latency.

    ReplyDelete
  2. Basically it is simple DNS routing nothing else.
    Ahh..thanks for correction. Done!!

    ReplyDelete