Traffic Manager vs Load Balancer in Azure

Many people get confused with these two services:

  1. Traffic Manager
  2. Load Balancer

Think about it this way:

The Traffic Manager is like the agent you find when you enter a Bank who tell you:

  1. Take this QUEUE – you get in, until you reach the end of it.
  2. 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 :
    1. Hello
    2. What’s up?
    3. Here’s your request served
    4. Goodbye. Get out.

It is also very important to note that the Traffic Manager doesn’t handle any traffic, it just says where to go.

You can think about it this way:

The Traffic Manager is an Individual; The Load Balancer is a Group.

A Test Scenario:

  1. 1 Traffic Manager
  2. 1 Load Balancer
  3. 2 Virtual Machines with IIS

In more detail:

Name

Type

Address Or Alias

w1

IIS VM

w1.cocodrilo.space

w2

IIS VM

w2.cocodrilo.space

tfm.cocodrilo.space

Traffic Manager

CNAME for wwwtfm.trafficmanager.net

nlb

Load Balancer

nlb.cocodrilo.space

 

Like this:

1 Traffic Manager. 1 Load Balancer. 2 VMs

The Traffic Manager can direct traffic to different regions and it’s the first touch point 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.

The How-To

  1. 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.
  2. Configured the Load Balancer
  3. 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:

The IP is mapped to nlb.cocodrilo.space

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 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?

1st time I requested it:

 

2nd time

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?

Nothing to worry about, I stopped the VM1, the one with the Tree, and every single time I got back the online Website, the Bird. Nice feature by the Load Balancer, only giving you what is working and available.

Other Misc Settings

Every 5 seconds will verify if the endpoint is available, if after 2 fails is not. Then it will switch to the other available(s)

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.

 

 

@soyroberto