An increase in traffic to your web applications often results in more customers. The customers should always get satisfactory web performance. The surges in internet traffic towards the application might result in bottlenecks, which makes it difficult to provide users a clean interaction with the application. That is why traffic management is important for internet-facing applications. Azure provides a service for traffic management, called Azure Traffic Manager, that helps in distributing traffic across application endpoints. In this post, we will give a detailed understanding of the Azure Traffic Manager and how it works. Keep on reading to know all about the Azure Traffic Manager. Let us get started.
Azure Traffic Manager distributes traffic to services across the Azure regions. It is a DNS-based traffic load balancer which provides responsiveness and high availability of the services. The Traffic Manager considers the health of all the endpoints and uses DNS to route client requests to a service endpoint based on a traffic-routing method.
A service endpoint might be an application hosted on Azure or an internet-facing application outside of Azure. To suit the needs of different applications, the Azure Traffic Manager offers several endpoint monitoring options and traffic routing methods. It balances the traffic load on services according to set policies.
Here are the features that the Traffic Manager offers.
The key benefits of the Traffic Manager are,
A client connects to a service using a DNS name. The Traffic Manager will first resolve the DNS name of the service to the IP address. The client is then connected to the IP address of the service to access it. The Traffic Manager works at the DNS level, where it routes traffic to a specific endpoint based on a selected traffic routing method. It is neither a proxy nor a gateway. Clients will directly connect to the selected endpoint. The Traffic Manager will not see the data passing between the client and the service.
Become a Microsoft Azure Certified professional by learning Microsoft Azure certification course from hkrtrainings!
When a client wants to connect to a service, a DNS query will be sent to the configured recursive DNS service. A recursive DNS service, which is also known as local DNS, does not host the domains directly. It rather encompasses the process of contacting authoritative DNS services to resolve the DNS name. The recursive DNS finds the name server across the internet for the domain in the DNS query sent by the client.
It then contacts the name server to request the DNS record. It then returns the record that points to the traffic manager of the server. The DNS then sends a request for the traffic manager. Upon receiving the request, the traffic manager chooses an endpoint. The chosen endpoint is sent back as a DNS name record. The recursive DNS service finds the domain name server. The IP address of the service endpoint will be returned. The recursive DSN consolidates and gives a single DNS response. The client then connects to the IP address.
To route traffic to different endpoints, Azure Traffic Manager supports six types of traffic-routing methods. The routing method specifies which endpoint is returned through DNS.
An endpoint is referred to as application deployment. When the Traffic Manager receives a DNS request, it checks for all the endpoints and chooses an available one, and returns it as a DNS response. Traffic Manager supports the below 3 types of endpoints.
Let us create a Traffic Manager profile that provides high availability for your application. Navigate to https://portal.azure.com/ and login to your Azure account. You have to deploy your web application in two different Azure regions. So, one will act as a primary endpoint and the other acts as a failover endpoint.
Learn more about AWS vs Azure from this Article Difference between Azure and AWS!
Click on the 'Create a resource' button on the top-left corner. Click on 'Web' and click on 'Web App'. You will get a Basics tab where you can fill the web application details. Create a resource group and give a name for it. Give a name for your web application. Select 'Code' for the 'Publish' field. Give 'ASP.NET V4.7' for 'Runtime stack', select Windows for 'Operating System', select 'East US' for the 'Region' field. Create a new service plan and give a name for it. Select 'Standard S1' for the 'SKU and size' field.
Go to the Monitoring tab, select no for 'Enable Application Insights' option. Click on 'Review and create'. You will get a review page where you can view all the settings. Click on 'Create' to create a website. Follow the same steps to deploy the web application in a different Azure region.
Click on 'Create a resource' on the top-left corner. Click on 'Networking' and then click on the 'Traffic Manager profile'. Click on 'Create Traffic Manager profile' and a settings page appear. Give a name for the Traffic Manager profile, Select 'Priority' for the 'Routing method' field, select a subscription method, select your existing resource group, and give the location of the resource group for the 'Location' field. Click on 'Create' to complete the process.
Give the Traffic Manager profile name in the search bar and select your profile from the results. Click on 'Settings' in the Traffic Manager profile. Click on 'Endpoints' and then click on 'Add'. Select 'Azure endpoint' for the 'Type' field. For the 'Name' field, enter the endpoint that you want to set as the primary one. Select 'App Service' for 'Target resource type', select 'Choose an app service > East US' for 'Target resource', choose 1 for 'Priority' field, and click on 'OK'. Repeat the same steps for the other endpoint and set the priority as 2.
You can find the DNS name of your web application in the overview of your Traffic Manager profile. Enter the DNS name in a browser, and you will get the default website of your web application. Now, disable your primary site in the Traffic Manager profile. Select your primary endpoint in the overview section. Click on 'Disabled', and then click on 'Save'. You can observe the status as disable when you close the primary endpoint. Check the same DNS name in a different browser, you can see that your web application is still available. You are routed to the failover endpoint.
Now that you know how to create a Traffic Manager profile, deploy your web application, create multiple endpoints, and try setting up a Traffic Manager profile. It widely improves website response. To reference an Azure Traffic Manager profile, you can also create an alias record name. You can create a Traffic Manager profile through the Azure portal, Azure CLI, and Azure PowerShell. It follows a pay per use pricing plan.
Other related articles:
30th October | 07:00 pm