A common practice to increase the performance and availability of a web application is to distribute it in multiple servers across the globe. Thus, customers will be served from the data-center that is closer to them, thus reducing response latency. In addition, when one server confronts downtime, other servers will handle the requests without the user noticing it. In this post we will explore how easy it is to setup Azure Traffic Manager to geo-route incoming traffic to different data-centers, and how this comes in handy when an application faces downtime as it routes traffic to a different server.

First things first, some info regarding Azure Traffic Manager.

What is Azure Traffic Manager?

Azure Traffic Manager is a service that allows you to control the distribution of user traffic to your service endpoints which run in different data-centers around the world. It provides three traffic routing options:

  • Priority, where traffic is directed to a primary service endpoint and backups are provided in case the primary or the backup endpoints are not available.
  • Weighted, where traffic is distributed across a set of endpoints, either evenly or according to defined weights.
  • Performance, where endpoints are distributed across different geographic locations and traffic needs to be directed based on the closest endpoint in terms of the lowest network latency.

What is it good for?

It is much more than a load balancer and can assist you in scenarios like:


Lastly, Traffic Manager billing is based on the number of DNS queries received, with an additional charge for each monitored endpoint.


To showcase how Azure Traffic Manager works, the following is necessary:

  • an Azure Traffic Manager profile
  • 2 x App Service Plan in different data-centers
  • 1 web application for each app service plan
  • a proxy to test the requests from a different part of the world

Create Web Apps in different data-centers

Create two web applications, which will be deployed in two different data-centers; keep in mind that the App Service Plan of both of them should be of Standard 1 (S1) or higher, in order to work with traffic manager.

webapp-us webapp-eu

Deploy Web Apps to the appropriate data-center

There is a slight change to the brand name of each app, so as to easily figure out where each app is deployed. The web app that is going to be deployed in a US data-center will have brand name “TrafficDemo US” and the one that will be deployed in an EU data-center will have “Traffic Demo EU”.

Traffic Demo US


Traffic Demo EU


Azure Websites in different data-centers


Creating a new Azure Traffic Manager Profile

To create a new traffic manager click on New -> Monitoring & Management -> Traffic Manager Profile. Choose a friendly name, select the Routing method to use (Performance works fine in this example) and click Create.


Setup Endpoints

After creating your Azure Traffic Manager Profile you need to add endpoints to the applications the traffic routing of which you want to manage. Based on the Performance routing method, requests from US will be handled by traffic-us.azurewebsites.net and requests closer to EU will be handled by traffic-eu.azurewebsites.net.


In the upper right corner there is a DNS name `traffic-demo.trafficmanager.net`, so when hitting this url, based on your location, your request will be served by the closest web app.

Note: You may point your custom domain to an Azure Traffic Manager domain simply by updating your DNS resource record to the following:

www.yourdomain.com IN CNAME traffic-demo.trafficmanager.net

Test Traffic Manager

To test that Traffic Manager works as expected, you can use a proxy service that will allow you to fake the location from which you are accessing your website.

Accessing your website from United States


Accessing your website from Germany, Europe


Testing Availability

Now that you have tested that you are served with the website that is closer to you, you can go a step further and test what would happen if you accessed your website from the United States but the application hosted in the US data-center had been stopped.


You can see that you are served with the second available endpoint, which is a website hosted in the EU, without noticing any of the downtime.

Categorized in: