In the post Publishing ASP.NET Core on Azure I demonstrated how to create and publish a ASP.NET Core application on Azure via AppService. The application was published in 3 data centers in different locations, as follows: Brazil, United States and Europe to high availability.
Having the datacenters located in 3 different continents, I can improve performance by reducing the latency of access to my application for those users that access from other countries. For example, the performance will be better for US users if they access the application hosted on US rather than the application hosted in Europe or Brazil.
In the previous post, the application was published and exposed through the following URLs:
To ensure that users can access the applications from the URL with better response time (latency), and also to warranty high if any of the sites is unavailable, I'll use the Azure Traffic Manager.
Azure Traffic Manager is a load balance service that allows you to configure a DNS and, for example, define a rule that time to time checks (pings) what is the best latency and redirects the access to the application with best performance site.
To configure, go to Azure Portal and create a new Traffic Manager through the New button available at the left menu. The following screen will be displayed. Click on the Create button.
On the next screen, enter the application name to compose the URL that will be exposed by the load balancer. You need to choose the balancing method. I choose Performance method because I want that the users be directed to the site that has the best latency. Also, you need to select Resource Group that contains your application.
The next step is to create the endpoints, i.e., to inform what are the sites (URLs) of your application. To add endpoints, click the Add button:
As the first endpoint, I will give the name BR and point it to the application of Brazil (MyAppOnCloudBR).
As we have three datacenters, we need to repeat twice this procedure to configure the endpoints for US and EU.
In the previous post, I used the free plan to host my application in the Azure data centers. But to use Traffic Manager, I need to use at least the Standard Plan to have the traffic manager option. In this case, I changed the plan for Standard 1 Small. To change the plan, click on each of AppServices, click on the App Service Plan and Scale Up (App Service plan), as follows:
After changing the plans of my applications, my three endpoints will be enabled and online as:
Once the traffic manager has been configured, now I can access my application through the load balance URL myapponcloud.trafficmanager.net instead of individual URLs for each datacenter.
I hope you have enjoyed.