Azure Storage Static Website and Azure Front Door

栏目: IT技术 · 发布时间: 5年前

内容简介:This Azure on the Cheap post highlights a technique that is gaining in popularity that uses Azure Front Door to globally distribute static websites hosted in Azure Storage. In this technique, we use Azure Front Door as a global HTTP load balancer to distri

This Azure on the Cheap post highlights a technique that is gaining in popularity that uses Azure Front Door to globally distribute static websites hosted in Azure Storage. In this technique, we use Azure Front Door as a global HTTP load balancer to distribute web requests to the closest, re., lowest latency, static website to the requester.

Take a scenario where you want to host a public facing website for a global company. You could host the website out of a single location but you want to ensure a good experience for visitors across the

globe.

Azure Storage Static Website and Azure Front Door

For example, visitors in New York and Los Angeles should be directed to the website hosted out of the Central US region while visitors from Berlin should be directed to the website hosted out of the UK South region. The latency between the visitor and the datacenter in the region is minimized in this way.

Let's take a look at the technology involved in this technique in a bit more detail.

Azure Storage - Static website

Enabling static websites on an Azure Storage Blob service allows you to host static content. This may include static content and client-side scripts but server-side scripting is not supported. When enabled you get a primary endpoint and to designate a page that is served up when the root of the primary endpoint is called as well a document to supply for document not found errors (404).

Azure Storage Static Website and Azure Front Door

The files are hosted in a blob container named $web:

Azure Storage Static Website and Azure Front Door

For more information on hosting static websites from Azure Storage, please see Static website hosting in Azure Storage .

For the demo, I used GitHub Actions to deploy a website to multiple regions including Southeast Asia, UK South and Central US. These are shown below:

Azure Storage Static Website and Azure Front Door

Using JMeter and Azure DevOps, my plan is to perform load tests against the websites hosted in these regions to get a gauge of the performance with and without using Azure Front Door.

JMeter and Azure DevOps Load Tests

Using JMeter , I created a simple script that hits the website. In an Azure DevOps project, I setup some Load tests using the script. You can find Load tests in the Test Plans section:

Azure Storage Static Website and Azure Front Door

My first two tests were to run against the website hosted in the Central US region. The first run was in Singapore while the second was in Iowa. Though this is not an exhaustive test, we can see a clear difference between the two locations:

Azure Storage Static Website and Azure Front Door

Iowa, being in the same region shows an average response time of 4.4ms while Singapore shows an average of 361.4ms.

Now, let's setup Azure Front Door for these regions.

Azure Front Door

Setting up Azure Front Door was simple. Let's look at the visual designer to show how simple it was:

Azure Storage Static Website and Azure Front Door

The Frontend describes the public url and in this example it is AzureOnTheCheap.azurefd.net. This directs to a backend pool, StorageAccounts. In the accounts, I have three defined all with equalpriority:

Azure Storage Static Website and Azure Front Door

Azure Front Door will monitor the health of the backends. If a backend becomes unavailable, then traffic will be routed to the next closest endpoint.

The routing rule, ToStorage, defined simply forwards the request from the front end to the backend pool. In this example, I just set up the route to send any HTTP or HTTPS traffic to the backend pool. For more detail on routing, please see How Front Door matches requests to a routing rule .

Back to Azure DevOps Load Tests

Now that we have Azure Front Door setup, let's run the same tests but instead of using a single region, the traffic is distributed by Azure Front Door.

Azure Storage Static Website and Azure Front Door

In this run, Iowa's performance still looks pretty good at 7.4ms but Singapore, now that it is routing to the Southeast Asia region shows a considerable improvement from 361.4ms to 31.5ms.

Cost

Please see Azure pricing forAzure Front Door andAzure Storage for specifics but the following is a general guide. Azure Storage for a static website will be insignificant compared to Azure Front Door especially when you add features like caching (makes sense especially as the content will be static).

The pricing of Azure Front Door has several components. The number of routing rules, domains and Web Application Firewall have  a per hour or per month pricing. In my implementation I had one routing rule and one domain which cost me about .70 USD a day.

Azure Storage Static Website and Azure Front Door Azure Storage Static Website and Azure Front Door

Azure Front Door will use health probes to determine the state of the backend hosts so there will always be a level of bandwidth usage. In my implementation this resulted in about .05 USD a day and my testing, between 1000 - 3000 requests a day generated less than .01 USD a day.

Azure Storage Static Website and Azure Front Door Azure Storage Static Website and Azure Front Door

So for less than a dollar a day, I was able to implement a static website with global routing and high availability.

Summary

Azure Front Door and Azure Storage Blob provide a global, highly available solution for hosting static websites. This can be achieved with a small amount of setup and a low monthly charge.

What are your thoughts on this Azure on the Cheap highlight? What architecture, techniques, or technologies would you highlight in Azure on the Cheap?

Please let the Azure Development Community know by adding a comment.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

数据驱动设计

数据驱动设计

[美]罗谢尔·肯(RochelleKing)、[美]伊丽莎白F.邱吉尔(Elizabeth F Churchill)、Caitlin Tan / 傅婕 / 机械工业出版社 / 2018-8 / 69.00元

本书旨在帮你了解数据引导设计的基本原则,了解数据与设计流程整合的价值,避免常见的陷阱与误区。本书重点关注定量实验与A/B测试,因为我们发现,数据分析与设计实践在此鲜有交集,但相对的潜在价值与机会缺大。本书提供了一些关于在组织中开展数据实践的观点。通过阅读这本书,你将转变你的团队的工作方式,从数据中获得大收益。后希望你可以在衡量指标的选择、佳展示方式与展示时机、测试以及设计意图增强方面,自信地表达自......一起来看看 《数据驱动设计》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具