Tuesday, June 17, 2014

Performance load balancing using Azure Traffic Manager – step by step guide


Before proceeding ahead I will strongly recommend you to go through the basics of Azure Traffic Manager from link - http://sanganakauthority.blogspot.com/2014/06/understanding-azure-traffic-manager-for.html
Hope you have now basic background about working of Azure Traffic Manager.
So in this below article I am going to show a way how Azure Traffic Manager can be used to perform load balancing based on performance.
Problem Statement –
Let’s say I have created a wonderful web application related to Kid’s Parenting Tips and it is big hit now. (Although I don’t have any kids yet!! J J). So people around the world wish to get those wonderful tips from my application. However, fame comes with problems!!!
I have hosted my application in an azure cloud service in West Europe region. A good number of users located in Asia are accessing my application and they reported very low latency, low bandwidth and slow loading of my web application; in short poor performance. This is because; users in Europe are getting served from Europe data center only which is fine however Asia users are also getting served from the same Europe datacenter hosted application and hence poor performance. What I want is, users from Asia should get request served from nearest datacenter to their physical location which is Asia datacenter. Hence it is much obvious that I should host copy of my parenting web application in Asia region datacenter as well.
But the problem still remains, even if I have copy of my application hosted in Asia region, how do I make sure that users from Asia are getting request served from Asia region only and Europe users get request served from Europe region datacenter hosted application only?
This is where we can use Azure Traffic Manager with Performance load balancing technique.
Implementation –
Ok, I have created two different cloud services with following details –
1.     Kunalcloudservice1 in West Europe region

2.     Kunalcloudservice2 in South East Asia region

After this I created a sample cloud service project with default asp.net web role and deployed in these two cloud service.

Then I click on Traffic Manager in my subscription and created new traffic manager service with Performance type of load balancing method  as specified below –


It takes around 30 minutes for Traffic manager to get in ready status. Now as of now there are no endpoints associated with Traffic manager. Therefore you will see the status as Inactive. Screenshot as shown below -




Let’s add earlier created cloud services as endpoints in traffic manager. It will take some time to get active. 
 
 
 
Now if I browse using traffic manager URL from my machine located in India then I am getting actual application default page as shown below –


However from this I cannot know from which location my request is being served. Ideally as per the concept of load balancing of Azure traffic manager, I should get served from kunalcloudservice2.cloudapp.net which is from SouthEastAsia region. To know this, let’s use nslookup command. So I opened command prompt in elevated mode using run as administrator option and then I ran nslookup command on traffic manager url. Bingo!!


The result showed the address of kunalcloudservice2.cloudapp.net. Means when I am accessing my application using traffic manager URL from India location I am actually getting server from nearest location which is SouthEastAsia. 

Similarly If I try to access the nslookup from a machine located in Europe (I have configured a Azure VM in West Europe region) then I am getting response from kunalcloudservice1.cloudapp.net which is in Europe region only. 

This is how Traffic Manager can be used to improve the performance of your application based on location of users.
Hope this helps.
Cheers…
Happy Traffic Management!!!
Please share your feedback/ comments about this post.

No comments:

Post a Comment

You may find this Interesting !!