Photo by Luca Bravo on Unsplash
Traffic Manager vs Load Balancer in Azure
3 min read
Many people get confused with these two services:
The Traffic Manager is like the agent you find when you enter a Bank who tell you:
Take this QUEUE - you get in, until you reach the end of it.
You're attended by the next available agent. Not by one in specific but by the next available. It's random. Agent is free, he/she raises its hand and says, you're up :
Here's your request served
Goodbye. Get out.
You can think about it this way:
The Traffic Manager is an Individual; The Load Balancer is a Group.
A Test Scenario:
1 Traffic Manager
1 Load Balancer
2 Virtual Machines with IIS
Address Or Alias
The Traffic Manager can direct traffic to different regions and it's the first touchpoint of a request. It's also used in redundancy scenarios to provide continuity, so, in this scenario, basically, the number of components would be duplicated. In separate Data Centers or Azure Regions.
I set up a couple of VMs with Windows 2012 R2 and the IIS default website configured. In order to use the load Balancer, they have to be in the same Availability set.
Configured the Load Balancer
Setup the Traffic Manager
Load Balancer Configuration
Added the VMs on the Same availability set to the Load Balancer Backend pool. Also, very important you have to allow traffic to port 80 in the Network Security Group otherwise it won't be possible to connect to the endpoint.
The Inbound NAT rule is also part of the configuration. In this test, all incoming traffic on Port 80 will go to an Availability set of 2 VMs. This is called nlb.cocodrilo.space. Remember this, the Load Balancer groups resources.
Another view of the configuration with the IP assigned at provisioning time:
[caption id="" align="aligncenter" width="2352"]
The IP is mapped to nlb.cocodrilo.space[/caption]
Traffic Manager endpoint is to the Load Balancer FQDN > nlb.cocodrilo.space and I also created a CNAME for www.cocodrilo.space which points to the Traffic Manager Azure given a name at provisioning time
This Traffic Manager only has 1 endpoint which is the Load Balancer, and behind it there are 2 VMs:
And how does it look?
Obviously you'd have the same service and the site would look exactly the same. This is to show how the service works/behaves.
What if one VMs goes off? Or it's rebooted?
Other Misc Settings
Another thing I tested in this configuration was persistence and that's why I get almost a 100% round robin every time I hit the address, because the setting was No persistence at all.