Azure Traffic Manager is a DNS-based load balancer. In this blog post, we show how Traffic Manager can be configured to provide resilience and high-availability to Azure Wep Apps.
In summary, here’s how Azure Traffic Manager works normally.
- Alice browse to a domain name URL https://example.azurewebsites.net
- Browser resolves domain name to IP address using DNS service
- DNS service checks with Azure Traffic Manager - what is the IP Address of example.azurewebsites.net?
- Azure Traffic Manager responds with IP Address and flows back to browser.
- Browser fetches page from application server.
- Alice sees the rendered page on the browser.
Azure Traffic Manager periodically polls for web app health. Upon detection of degradation of performance, Traffic Manager will direct traffic to the healthy web app.
Create Azure Traffic Manager and Endpoints
- Create Azure Traffic Manager from Azure Portal. As shown in the remarks, Traffic Manager is not bound to any location and is a global.
- After Traffic Manager is created, does not redirect traffic to any of the web applications. The screenshot below shows how to create an endpoint that points to an App Service
- Created two endpoints to two app services; one in Australia East and and another in Australia Southeast.
- Confirmed traffic manager is working by visiting the traffic manager URL.
- DIG traffic manager URL shows it resolves to the first app service failover-1.
Testing the failover
- Stop app service failover-1
2. Confirm app-service stopped.
3. Traffic Manager WORKS - page works normally.
4. Traffic Manager WORKS - DIG shows traffic manager resolves to failover-2.
- Expect slight seconds of delay between the failover between appservice by Traffic Manager.
- All browsers cache DNS resolution results; thus end-users will continuously experience failed site until the DNS resolution cache is cleared. DNS resolution cache duration differs between all major browsers.