Microsoft Azure

How to Improve Website Response using Traffic Manager

In this article, I will explain, how to Improve Website Response using Traffic Manager. Use Traffic Manager to create a highly responsive website by directing user traffic to the website with the lowest latency. Generally, the datacenter with the minimum latency is the one that is closest to the geographic distance.

In this article, you learn how to:

Create two virtual network
Create 2 VMs running a basic website on (IIS)
Configure DNS name for the VMs (running IIS)
Create two tests VMs to view Traffic Manager in action
Create a “Traffic Manager profile” for improved website performance
Add VM (Instance) endpoints to the Traffic Manager profile
View Traffic Manager in action

Prerequisites

In the interest of see the Traffic Manager in action, this article requires that you deploy the following:
2 instances (VMs) of basic websites running in different Azure regions – (East US and West Europe).
2 test VMs for testing the Traffic Manager – 1st VM in West Europe and the 2nd VM in East US. The test VM (Instance) is used to represent how Traffic Manager Routes user traffic to the website that is running in the same region as it provides the lowest latency.

Improve Website Response using Traffic Manager

Sign in to the Microsoft Azure portal

Create a virtual network

1- In the search bar type (virtual networks) to find or from the Azure portal menu and then select virtual networks.

azure menu

2- In the virtual network, select the add button create a virtual network.

azure create virtual network

3- Create virtual network window, choose your subscription. Resource Group, select create new to create.

Enter a resource group name (rg-vnet) and then click ok.

azure create virtual network

4- Under the instant details type a virtual network name (vnet01).
Choose a location to use as the basis for your virtual network. Select a location that is near to your location to increase performance. Click on Next: IP Addresses >

azure create virtual network basic

5- Choose an address space IPv4 address space, I am selecting 10.1.0.0/8, but if you prefer to use a different address feels free. Click + Add subnet

azure create virtual network ip address

6- In the Add subnet wizard, type a subnet name (vnet-subnet) and then type 10.1.0.0/24 for Subnet address range.
To create service endpoint policy to allow traffic then select a service under services.

azure vnet add subnet

7- Click Next : Review + Create >

azure create virtual network ip address

8- Virtual network validation passed, selects Create.

azure create virtual network validation

9- To create a 2nd virtual network follow the above steps from 3 to 6 again with the following changes.

SettingValue
Resources Grouprg-westus
Namevnet-westus
Region(US) west US
IPv4 address space192.168.0.0/16
Subnet namesubnetwestus
Subnet address range192.168.1.0/24
Create 

9- Virtual network overview.

azure create network virtual

Create Virtual Machines

Now we need to create VM in each virtual network so that we can communicate between them.

1st VM

1- Azure portal menu tab, select Virtual machines.

microsoft azure menu

2- Select the + Add button to create virtual machine.

azure virtual machine

3- Resource group select existing (rg-eastus).

azure new vm wizard

4- Instance details

Enter a virtual machine name (server-eastus)
Region select (East US)
Image selects Windows Server 2019 Datacenter. You can select a different operating system, but the remaining steps presume you selected Windows Server 2019 Datacenter.

azure vm instance details

5- Administrator account.

Enter a username (jamil), Password.
Public inbound ports choose allow selected ports.
Select inbound ports (HTTP, RDP) and then click Next : create >

azure new vm wizard

6- Under Management tab
Monitoring boot diagnostics (off) and then click Review + create

azure new vm management

7- Select create

azure new vm create

Create the second VM

Complete steps 2 to 7 again, with the following changes:-

NameValue
Resource grouprg-westus
Virtual machine nameserver-westus
Region(US) West US
ImageWindows Server 2019 Datacenter
Administrator accountusername password
Public inbound portallow selected ports
Select inbound portsHTTP, RDP
Management tabmonitoring boot diagnostic (off)
Review + create 
Create 

The VMs take a few minutes to create. Now the both VMs (web1, web2) successfully created.

azure virtual machine

Configure DNS names for the VMs running IIS

In this section, we will configure the DNS names for the IIS servers – server-eastus and server-westus.

1- Select server-eastus

azure virtual machine

2- Overview page, under DNS name, select Configure.

azure virtual machine overview

3- Select Configuration under settings, under DNS name label (optional), enter a unique name, and then select Save.

azure virtual machine configuration

4- Select server-westus.

azure virtual machine

5- Overview page, under DNS name, select Configure.

azure virtual machine overview

6- Configuration page, under DNS name label (optional), type a unique name, and then select Save.

azure virtual machine configuration

Create Test VMs

In this section, you create a VM (vmtest-eastus and vmtest-westus) in each Azure region (East US and West US). We will use these VMs (Virtual Machines) to test how Traffic Manager routes traffic to the nearest IIS server when we browse to the website.

1- On the upper, left corner of the Azure portal, select Azure menu, and then select virtual machine.

microsoft azure menu

2- In Create a virtual machine, click on + add button.

azure virtual machine

3- In the Basics tab
Select Subscription
Resource Group – Select rg-eastus.

azure new vm wizard

4- Instance Details

Virtual machine name – Type vmtest-eastus.
Region – Select East US.
Image – Windows Server 2019 Datacenter.

azure vm instance details

5- Administrator Account

Username – Enter a user name.
Password – Enter a password.

Public inbound ports – Choose Allow selected ports.
Select inbound ports – Choose HTTP, RDP in the pull down box.

azure new vm wizard

6- Review the settings, and then click Create.

azure new vm create

Follow the Steps to Create a 2nd VM.

SettingsValue
Resource grouprg-westus
Namevmtest-westus
RegionWest US
ServerWindows server 2019 datacenter
Administrator accountUsername, password
Public Inbound portsHTTP, RDP
Review + create 
create 

The VMs take a few minutes to create. Please do not continue with the remaining steps until all VMs are created.

azure virtual machine

Create a Traffic Manager profile

To create a Traffic Manager profile that instructs user traffic by sending them to the endpoint with lowest latency.

1- In the Azure search type traffic manager, select Traffic Manager Profiles.

azure search bar

2- Traffic Manager profiles, click the + Add.

azure traffic manager profile

3- In the Create Traffic Manager profile wizard
Name – Type a name (trafficmanager33)
Routing method – type Performance
Select Subscriptions
Resource group – select rg-eastus
Select Create

azure create traffic manager profile

4- Traffic Manager profiles.

azure traffic manager profile

Add Traffic Manager Endpoints

Add the two VMs running the IIS servers – server-eastus & server-eastus to route user traffic to the closest endpoint to the user.

1- In the portal’s search bar, search for the Traffic Manager profile and then select it.

azure search bar

2- In Traffic Manager profile, click on trafficmanager33.

azure traffic manager profile

3- Select Endpoints under settings, and then click + Add.

azure traffic manager endpoint

4- Add Endpoint

Type – Azure endpoint
Name – eastusendpoint
Target Resource type – Public IP address
Public IP address – server-eastus-ip
Click Add

azure add endpoint wizard

5- Select + add button again for second endpoint.

azure traffic manager endpoint

6- Add Endpoint

Type – Azure endpoint
Name – westusendpoint
Target Resource type – Public IP address
Public IP address – server-westus-ip
Click Add

azure add endpoint wizard

7- After the addition of both endpoints completed, they will displayed in Traffic Manager Profile together with their monitoring status as Online.

azure create endpoint wizard

Test Traffic Manager Profile

Determine DNS name of Traffic Manager Profile

In this step, we use the DNS name of the Traffic Manager profile to visit the websites.

1- In the Azure search bar, search for the Traffic Manager profile name and then select it that we created in the preceding section. select the traffic manager profile.

azure traffic manager profile

Overview

2- Your Traffic Manager profile will display the DNS name of your newly created one.
Copy DNS name

azure traffic manager profile overview

Improve Website Response using Traffic Manager

3- Go to the virtual machines and then click vmtest-eastus.

azure create virtual machine

4- Connect virtual machine (server-eastus), using RDP.

5- Open web browser on the VM (instance) vmtest-eastus, enter the DNS name of the Traffic Manager profile to view the website. Since the VM located in East US, you are routed to the nearest website hosted on the nearest IIS server server-eastus that is located in East US.

east server

6- Connect virtual machine (server-westus), using RDP

7- Open web browser on the VM vmtest-westus, type the DNS name of your Traffic Manager profile to view your website. Since the VM located in West US, you are routed to the nearest website hosted on the nearest IIS server server-eastus that is located in West US.

west server

Jamil Parvez

Jamil Pervez works as a Network Administrator, based in Kuwait with a Primary focus on Microsoft technologies. Microsoft Certified MCSE, MCTP, MCITP, CCNP, CCIP, CCVP with 20 years of experience in administering Windows Servers, Exchange, VMWare, Veeam B&R, Veritas BackupExec.

Related Articles

Leave a Reply

Back to top button