Exploring Azure’s Traffic Manager with My Web Apps

Exploring Azure’s Traffic Manager with My Web Apps

Today I tinkered with my soon to be expiring “Free Trial” subscription by creating and configuring a Traffic Manager [link] in the new Azure Portal. I also setup a test sub-domain on my personal site to redirect website visitors to this traffic manager. Then I tested traffic routing by performance, weighting, and priority methods to my endpoints (either my web app1 or web app2 app services) that I also created in Azure.

This article will walk though my project on how I created, configured, and tested the components required to work together for success. During my project I discovered an unexpected issue [link] that I reported to the Microsoft forums that later turned out to be related to browser caching but I would like to mention it here: that a user’s browser can and will cache a specific web app and utilize that same web app even if the traffic manager should direct the user to a different web app. Because of that browser caching issue, I think the Traffic Manager should probably be setup with careful thought about the current and future traffic management needs of the organization and the user experience. If one web app or resource gets browser cached and used too much, you may be able to auto-scale up/down that resource in the cloud to account for the user browser caching of the web app.

Also, I should mention that when your web app loads, you will see the final URL as your traffic manager DNS URL and not the destination web app URL in the browser window. I have not yet seen a custom domain link/setting under the traffic manager profile so I cannot say for sure if you can change that final URL to show your custom domain for marketing/branding/other purposes.

Creating a Traffic Manager in Azure Portal

To create a new traffic manager resource, you can find the “Traffic manager profile” under + New -> Azure Marketplace -> Networking.

So, the marketplace template product says the following quote:

“Use Traffic Manager to:

  • Improve app availability with automatic failover.
  • Increase your app’s responsiveness by routing end users to the Azure location with lowest network latency.
  • Seamlessly combine on-premises and cloud.”

I’m scratching my head at “Improve app availability with automatic failover” because business continuity is a combination of IT architecture and techniques (such as deployment slots) and also because the traffic manager solution won’t help users with an old or offline app cached in their browser [link]  that is supposed to be redirected to a different “online” app, so they would be loading potentially a web app resource that was offline and when they were meant to be redirected somewhere else, which does not improve app availability during an automatic failover.

Here is a screen capture of my Traffic Manager profile that I created:

I selected Performance routing but you can change that routing method later under the traffic manager profile to another setting like weighted or priority.

Adding Endpoints to Traffic Manager

Endpoints need to be added for your traffic manger to know how and where to redirect to which resources. I created two web apps (web app1 and web app2) for my respective endpoints (endpoint1 and endpoint2). I learned by trial and error, that endpoints must be added that are in different resource locations (at least the App Service endpoints). I received this validation error when I tried to click “Save” on my second endpoint for my web app 2 that was originally in the “South Central US” location (same as my web app1):

Failed to save configuration changes to Traffic Manager profile ‘kwsitemanager’. Error: Some of the provided Azure Website endpoints are not valid: One or more conflicts detected in traffic manager configuration. Multiple domains point to region “South Central US”: ……

For example, I could not add two different endpoints for two different web apps at the same resource location. Not sure why, but it did not validate and required two different resource locations. I ended up creating my web apps at South Central US and West Coast locations. My web app2 “West Coast App” profile settings are shown below. I also had to select an App Service plan in a different location than my endpoint1 “web app1”.

To add endpoints to your traffic manager, open the traffic manager then go to Settings -> Endpoints -> + Add.

For the “target resource type” you currently have your choice of: Cloud Service, App Service, App Service Slot, or Public IP Address. Ok, I admit I did not tinker with all these different resource types of Traffic Manager and chose only to test the App Service for my project.

One of my endpoint profile setup settings “endpoint2” is shown below for “web app2” app service called “myWestCoastApp”.

Here is a screen capture of my traffic manager project with two endpoints to go to my web app1 and my web app2 respectfully.

Note: In order for endpoints to validate, they must point to App Services in different LOCATIONS.

Redirecting Your Website to Traffic Manager

My next step was to create a fictional subdomain called trafficmanager.katiegirl.net and have it redirect to the DNS of my Azure traffic manager. In hindsight, it was a poor choice to illustrate my story and I should have created something called clickbait.katiegirl.net. My users will go to my personal website URL which will then will redirect it to the Azure DNS of the traffic manager and based on the configuration settings, my Azure traffic manager will send them to either web app1 or web app2 endpoints.

I setup my website to redirect to the Azure DNS below as shown in this screen capture of my cPanel configuration of my site running on Apache.

Configuring Traffic Manager

You can change the Routing method and other settings under your traffic manager profile Settings -> Configuration. When you change the routing method, be sure to go to settings -> endpoints and check/update your endpoint settings because depending on the routing method, new fields will appear for your endpoint.

Here is a screen capture showing my configuration settings for my site manager.

Here is an example of both my endpoints setup to be equally weighted with a routing method of “weighted” in the configuration settings.

Here is an example of my endpoint for web app1 being of higher priority for a routing method of “priority” in the configuration settings.

Testing it Out

I tested out the traffic manager with all sorts of different routing methods and endpoint settings. I created a batch file to load hit my site +50 times, etc.…

“C:\Users\THEUSER\AppData\Local\Google\Chrome\Application\chrome.exe”

start “webpage name” “http://trafficmanager.katiegirl.net/”

start “webpage name” “http://trafficmanager.katiegirl.net/”

start “webpage name” “http://trafficmanager.katiegirl.net/”

..

My traffic manager directed me to either my web app1 or web app2, you can see screen capture of my most awesome web apps I created in about a minute’s time (worthy of a webby? Hehe).

Note: The browser displays the URL of the traffic manager DNS not the web app that it redirected to, so if the user bookmarks the web app, it will bookmark your Azure traffic manager DNS.

As mentioned in the introduction, I hit a snag to where I was seeing unexpected results and seeing only one endpoint web app load at a time in my browser even though I loaded traffic manager instantaneously in 50 new browser tabs. During my project I discovered an unexpected issue [link] that I reported to the Microsoft forums that later turned out to be related to browser caching but I would like to mention it here: that a user’s browser can and will cache a specific web app and utilize that same web app even if the traffic manager should direct the user to a different web app.

To get around this, you probably would need to write more detailed and complex custom test scripts that clear browser cache, or use different browsers, etc… and record results. There are all sorts of IT techniques to test and record the data you need to verify routing. In my project, I was just looking to verify the traffic manager routing on a high level without writing detailed test scripts. I verified the routing methods using different browsers.

Traffic Manager – Traffic View

I created and deployed a traffic view [link] feature (and thought it was extra $ out of my account). Traffic View is a feature on my traffic manager resource that was supposed to provide me additional insights and eye candy. Unfortunately, after 48 hours, the feature did not deliver any data.

The blade defaulted to empty and this message:

“The requested heat map content does not exist. This could be because the given profile has not received any queries in the previous 7 days. If any query was received, it may takes up to 24 hours to show in the heatmap.”

According to the documentation, I learned this feature may not actually be working.

“The Traffic View feature in Traffic Manager is in Public Preview and may not have the same level of availability and reliability as features that are in general availability release. The feature is not supported, may have constrained capabilities, and may not be available in all Azure locations. For the most up-to-date notifications on availability and status of this feature, check the Azure Traffic Manager updates page.”

So, I was a little disappointed to learn that my traffic view feature never worked as I thought it should. I would had liked to have seen what additional data analytics my traffic manager could provide.

Traffic Manager – Monitoring – Metrics (Preview)

The blade in my traffic manager for metrics said “preview”, so I assumed that meant the feature was still in beta status. So far, the only metrics you can see are the endpoints status and queries. I am assuming the reason why I don’t see my ~50 queries on the charts below was because of the browser caching issue as mentioned previously.

The metrics for my two endpoints for my traffic manager are shown below. I have two different charts showing “queries by endpoint returned” filtered by specific endpoint name.

A word of caution is that when you click on a different blade or close out this blade, your charts are not saved and will disappear! However, you can pin the chart to the dashboard. This metrics blade feature definitely has room for an improved user experience.

Summary

I hope you enjoyed reading my article as I had much fun making this project. Remember technology and websites change everyday so it is likely by the time you are reading this, something newer and better has happened with the Azure Traffic Manager products.

Kathleen has 15 yrs. of experience analyzing business IT needs and engineering solutions in payments, electric utilities, pharmaceutical, financial, virtual reality, and internet industries with a variety of technologies. Kathleen's project experience has been diverse ranging from executing the business analysis “design phase” to hands-on development, implementation, and testing of the IT solutions. Kathleen and her husband reside in Indiana with no children, instead living along with their fur babies.