This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .
The Challenge: High Availability Matters:
As student entrepreneurs, we understand that ensuring high availability for our web applications isn't just a convenience; it's a necessity. Downtime and unreliable performance can impact our startups and student projects significantly. It's not just about keeping users happy; it's about seizing opportunities and maintaining our reputation in a competitive landscape. Picture this: You're preparing for a crucial presentation while simultaneously managing your web app, and suddenly it goes offline. That downtime can cost more than just frustration; it can cost opportunities. In the dynamic world of startups and academia, high availability isn't a luxury; it's a lifeline
The Solution: Azure App Service and Azure Traffic Manager
Azure offers a robust set of tools for building and deploying highly available applications. We'll focus on leveraging two of these tools: Azure App Service and Azure Traffic Manager.
Azure App Service: Azure App Service is a fully managed platform for building, deploying, and scaling web apps. With features like automatic scaling, continuous deployment, and integration with Azure DevOps, it provides an ideal foundation for hosting your web applications.
Azure Traffic Manager: Azure Traffic Manager is a global DNS load balancer that enables you to distribute incoming user traffic across multiple endpoints. By directing users to the nearest or healthiest endpoint, Traffic Manager enhances the availability and responsiveness of your application. In this QuickStart, you'll read about two instances of a web application. Each of them is running in a different Azure region. You'll create a Traffic Manager profile based on endpoint priority. The profile directs user traffic to the primary site running the web application. Traffic Manager continuously monitors the web application. If the primary site is unavailable, it provides automatic failover to the backup site.
What You'll Learn
- Provision a web application using Azure App Service.
- Configure Azure Traffic Manager to distribute traffic across multiple regions.
- Provision a web application using Azure App Service.
- Achieve high availability and fault tolerance for your web applications.
Our Approach: Deploying and Configuring for High Availability
I'll guide you through the process of deploying two same instance sample web application using Azure App Service. Each of them is running in a different Azure region. We'll then demonstrate how to configure Azure Traffic Manager to distribute traffic across different instances of the application hosted in various Azure regions. This approach ensures that your application remains available even if one of the regions experiences issues.
For this QuickStart, you will need two instances of a web application deployed in two different Azure regions (North Europe and East Us). Each will serve as primary and failover endpoints for the Traffic Manager.
- Clone this Repo https://github.com/deniswachira/azure-solution-samples
- Open the folder called “azure-traffic-manager-demo” and look at the file called environment-create.sh
- Sign into the Azure Portal, if you’re a student redeem Azure for students else create a free account
- Launch Azure PowerShell button and select Bash.
5. Paste the script file from environment-create.sh file to the bash on azure bash cli.
6. Verify you have pasted the script correctly and click enter button.
7. Congratulation you have provisioned 2 instance of web application, one North Europe and the other in the East US.
8. Configure each html file instance of both web apps with the following steps.
9. Copy the North Europe scm endpoint and paste it on a new tab.
10. Your new tab should open like this.
11. Select PowerShell on debug console button. Then select site -> wwwroot then click the pen icon to edit the html
- Paste the html code from the repo you cloned file named web-north-europe.html and click save.
12. Go back to North Europe web endpoint and refresh. You should have this.
13. Follow steps 8-11 to update the East Us instance endpoint. Use web-east-us.html file to update the instance root html file.
14. And finally, the 2 instances should be like this.
Create a Traffic Manager profile.
- Create a Traffic Manager profile that directs user traffic based on endpoint priority.
- Open Azure Portal, On the upper-left side of the screen, select Create a resource. Then search for Traffic Manager profile and select Create.
3. Name: Enter a unique name for your Traffic Manager profile. “azure-traffic-manager-profile-demo”
4. Routing Method: Select Priority.
5. Select Subscription, Resource Group and Location.
6. Select Create.
Add Traffic Manager endpoints.
- Click Go to resource.
Add the website in the EastUS as primary endpoint to route all the user traffic. Add the website in North Europe as a failover endpoint. When the primary endpoint is unavailable, traffic automatically routes to the failover endpoint.
2. In Traffic Manager profile, in the Settings section, select Endpoints, and then select Add.
3. To create a failover endpoint for your second Azure region, repeat steps 2 with these settings:
When you are done adding the two endpoints, they are displayed in Traffic Manager profile. Notice that their monitoring status is Online, if not so wait for some moment for the changes to take effect and refresh the browser.
Test Traffic Manager profile
In this section, you will check the domain name of your Traffic Manager profile. You'll also configure the primary endpoint to be unavailable. Finally, you get to see that the web app is still available. It's because Traffic Manager sends the traffic to the failover endpoint.
Check the DNS name
- In the portal’s search bar, search for the Traffic Manager profile name that you created in the preceding section.
- Select the traffic manager profile. The Overview appears.
The Traffic Manager profile displays the DNS name of your newly created Traffic Manager profile.
View Traffic Manager in action
- On a web browser, enter the DNS name of your Traffic Manager profile to view your Web App's default website.
Note: In this QuickStart scenario, all requests route to the primary endpoint because it is set to Priority 1.
2. To view Traffic Manager failover in action, disable your primary site:
3. In the Traffic Manager Profile page, from the Overview section, select eastUSmyPrimaryEndpoint.
4. In eastUSmyPrimaryEndpoint, select Disabled > Save.
5. Close eastUSmyPrimaryEndpoint. Notice that the status is Disabled now.
6.Copy the DNS name of your Traffic Manager Profile from the preceding step to view the website in a new web browser session.
7. Verify that the web app is still available. The primary endpoint isn't available, so you were routed to the failover endpoint.
Clean up resources
When you're done using the private link service, delete the resource group to clean up the resources used in this QuickStart.
- Enter “azure-traffic-manager-introduction” in the search box at the top of the portal, and select “azure-traffic-manager-introduction” from the search results.
- Select Delete resource group.
Conclusion: Delivering Uninterrupted Experiences
In the ever-evolving digital landscape, delivering exceptional user experiences is non-negotiable. Users expect applications to be available, responsive, and reliable always. Achieving this level of reliability requires a strategic approach to high availability, and Azure provides the tools to make it happen.
Through this guide, we have explored how Azure App Service and Azure Traffic Manager can be your allies in the quest for high availability. By leveraging the power of these services, you have learned how to architect your applications for redundancy, failover, and global responsiveness.
Remember that high availability is not just a technical checkbox—it is a commitment to delivering uninterrupted value to your users and customers. As you apply the principles and techniques outlined in this blog post, you are taking a significant step towards building a robust and dependable application infrastructure.
Whether your application is a business-critical enterprise system, a customer-facing e-commerce platform, or anything in between, the concepts covered here are applicable and adaptable. As technology continues to evolve, Azure's ecosystem will undoubtedly expand, offering even more ways to enhance availability and resilience.
So, go forth and implement what you've learned. Deploy your web applications with confidence, knowing that you have the tools to keep them available and performant. Embrace the journey of continuous improvement and innovation as you deliver experiences that delight your users in a world that never stops moving.
Thank you for joining us on this exploration of high availability in the Azure cloud. Your commitment to learning and your dedication to delivering excellence are what drive progress in the digital age.
To learn more about Traffic Manager and Load Balancing: