Azure_CDN

How to improve website performance and responsiveness using Azure CDN?

Websites have gone topsy-turvy since their inception. However, in 2024, if your website is not optimized, takes forever to load, doesn’t deliver the content as requested on time, and shows error or time out, you are in deep trouble. Google will kick you out of the SERP game. Gone are the times when users had the patience to sit back and wait for the websites to load. 

Interestingly, using Azure CDN, you resolve all the performance and optimization issues with a breeze while ensuring a seamless user experience. Azure CDN offers myriad features that will help you deliver content to audiences dwelling in any part of the world and accelerate the speed of accessing content for viewers. 

So this blog will help you understand what CDN Azure is, how it works, its features, and how it helps improve site performance and optimize content delivery using CDN Azure. Let’s dive in.

What is Azure CDN

Azure Content Delivery Network (CDN) offers a comprehensive solution for fast and high-quality content delivery to users by caching their content at carefully selected physical nodes worldwide. Azure CDN can speed up dynamic content that cannot be cached by combining numerous network enhancements with CDN POPs—for instance, route optimization to prevent Border Gateway Protocol (BGP).

Also Read: Azure CDN – Complete Guide

By sending web assets, such as Azure CDN, you guarantee the following:

  • Improved user experience and performance for end users, especially when using applications that require many round-trips to load content
  • Better scaling to manage sudden high loads, such as the start of an event for a product launch
  • Dividing up user requests and serving material straight from edge servers to cut down on traffic to the origin server

How does CDN Azure work?

When you request a file or an asset, Azure CDN uses a URL with a specific domain name, like <endpoint name>.azureedge.net. It can be an endpoint hostname or a custom domain. The CDN then routes the request via DNS to the nearest POP (point of presence) location.

However, if none of the edge servers in POP holds the file, then POP requests the file from the origin server. The origin server can be an Azure Web App, Azure Cloud Service, Azure Storage account, or any publicly accessible web server.Azure_CDN

Next, the origin server will send the file to an edge server in the POP, where it gets cached. The file is then served to the original requestor and remains cached on the edge server until its HTTP headers’ time-to-live (TTL) expires. The default TTL is seven days if not specified by the origin server.

Moreover, subsequent users can also request the same file using the same URL and be directed to the same POP. If the TTL for the file hasn’t expired, the POP edge server returns the file directly from the cache, leading to a faster and more responsive user experience.

Requirements of Azure CDN

To use CDN Azure, you must possess at least one Azure subscription. Furthermore, you must establish a CDN profile, which encompasses a set of CDN endpoints. Each CDN endpoint provides users with configurable content delivery behavior and access. 

CDN Azure Features

Here are some of the notable features of CDN Azure. 

Caching features to control caching behavior of Azure CDN 

Azure CDN offers two methods to manage file caching:

Caching rules

With caching rules, you can establish global caching rules for each endpoint in your profile, affecting all requests to that endpoint. You can define default cache expiration behavior globally, like URL path and file extension.

Query string caching

This feature lets you determine how Azure CDN caches requests with query strings.

Restricting countries based on regions or countries

Azure CDN offers a geo-filtering feature that enables you to create rules for specific paths on your CDN endpoint to allow or block content from selected countries based on the request’s origin.

Files Compression

Azure CDN provides a feature that allows you to compress files, resulting in faster file transfer speeds and better application performance by decreasing the file size. This feature reduces bandwidth costs. 

Optimize content delivery using Azure CDN 

Ensuring optimized content delivery to a worldwide audience is essential. To support this, Azure CDN now offers the capability to accelerate and optimize performance based on the specific scenarios in which you are using Azure CDN. These scenarios may involve delivering general websites or web applications, streaming media, downloading files, and more. By default, optimization is applied to the scenario you select in the “optimized for” option when creating a CDN endpoint.

Why Do You Need To Upskill Your Teams With The Azure AI Fundamentals?

Azure CDN applies various optimizations, such as caching, object chunking, and an origin failure retry policy. Creating a CDN endpoint depends on the specific content delivery scenario you choose. 

A few ways to optimize content. 

General web delivery

The most common optimization option is general web delivery, designed to optimize general web content, including web pages, web applications, files, and video downloads.

A typical website comprises static and dynamic content, with static content like images, JavaScript libraries, and style sheets that you can cache and deliver to different users. On the other hand, the CDN will personalize dynamic content for individual users, such as news items tailored to a user’s profile. As this dynamic content is unique to each user, it isn’t cached. 

General media streaming

Azure CDN Standard from Microsoft uses the general web delivery optimization type to deliver streaming media assets directly.

The media streaming optimization is specifically designed for live or video-on-demand streaming media that utilizes individual media fragments for delivery rather than a single large asset transferred via progressive download or byte-range requests. 

The general media delivery optimization leverage Azure CDN to deliver media assets faster. 

Video-on-demand streaming

Azure CDN endpoints optimize the delivery of streaming media assets using the general web delivery optimization type. These endpoints have specific features that assist in delivering media assets, including partial caching and the cache fill wait time feature. 

Partial Caching

Partial caching enables the CDN to serve partially cached content to new requests. When a request to the CDN results in a cache miss, the request is sent to the origin. 

Cache fill wait time

The cache fills wait time feature forces the edge server to hold subsequent requests for the same resource until HTTP response headers arrive from the origin server. If HTTP response headers from the origin arrive before expiring, CDN Azure will serve all requests on hold. Meanwhile, the cache is filled with data from the origin. These features are useful for video-on-demand streaming media using separate media fragments for delivery. 

Downloading large files

Azure CDN Standard employs object chunking, a technique used for large file delivery. When a user requests a large file, the CDN retrieves the file in smaller chunks of 8 MB from the origin. The CDN edge server requests the file from the origin in parallel chunks. Once a chunk arrives, the CDN immediately caches and serves the same to the user. 

Further, the CDN Azure prefetches the next chunk in parallel to stay one step ahead of the user, reducing latency. This process continues until the entire file is downloaded.

AWS Vs Azure: Which Cloud Platform You Can Choose In 2023?

The CDN caches the chunks as they are received. Further requests for the same files are served from the CDN cache. The entire file doesn’t need to be cached on the CDN.  However, for this optimization, the origin server must support byte-range requests. If the origin server doesn’t support byte-range requests, downloading data greater than 8 MB will fail.

Improving website performance using Azure CDN

Azure CDN uses a five-step process to migrate content when a user sends a request. 

Step 1: Evaluating the overall Architecture

To maximize the benefits of Azure CDN, you must ensure that the content’s origin is highly accessible to the CDN nodes. This will help you ensure fast content delivery, even on the initial load before the CDN caches the content.

website performance and responsiveness using Azure CDN

To achieve low latencies for content loading with Azure CDN, use Azure Blob Storage as the content origin. It requires a subscription, resource group, CDN Azure profile, and more. 

Step 2: Configuring storage account 

If you already have an Azure Subscription and a Resource Group, you need to set up the Azure Storage Account with the following:

  • Location: For better performance, choose the primary location where the assets will be available, closer to the website’s loading location.
  • Replication: Select Read-Access Geo-Redundant Storage to enable failover to another region in case of a primary location outage.
  • Data protection: Enable Point-In-Time to restore or Blob-Versioning for extra protection. 

Step 3: Migrating assets using AzCopy

Azure allows several options to migrate on-premises data to the cloud, including shipping disk drives directly to Microsoft for loading in the data center. To load data to Azure, use the AzCopy CLI; you must

  • Connect AzCopy to Azure
  • Generate a SAS token for the Storage Account
  • Execute AzCopy to upload the data. 

Once you upload assets to the Azure Blob Container, use the blob path to copy the Blob Container URL and access it. 

Step 4: Configuring CDN Profile

Now that the data is in an Azure Blob Container, we need to use an Azure CDN to ensure the assets are regionally dispersed and cached. Hence, creating an Azure CDN profile is the next step. When creating one, focus more on parameters like:

  • CDN Profile / Pricing tie
  • CDN Profile / CDN Endpoint Name
  • CDN Profile / Origin hostname
  • CDN Profile / Endpoint Caching Rules /Query String Caching behavior

Step 5: Making changes to the application

Your work doesn’t end with just optimizing the endpoints. You must ensure that the changes you uploaded in the Blob Containers are saved and processed without hassles. Moreover, when you add assets to web pages, they should always point to CDN Azure URLs and SAS tokens and be tied to query strings. 

However, the technique will vary with your tech stack, viz., CMS, frameworks, customized apps, etc. Here’s what you can do: 

  • Catch an asset uploaded event and then upload assets to the Blob Container. This helps continue to possess a version on-site.
  • Mention the CDN URL and consolidate the Asset URL creation logic. You can use the CDN cache by reusing SAS tokens wherever possible. Never, however, use the same SAS token for several users.
  • Third and most importantly, Blob Containers do not accommodate case-sensitive characters and some locations and filenames. If the link cannot support the pathways of your assets, a uniformization procedure will be required.

Summary

Hope this blog helps you understand the Azure CDN in detail and how it can help you optimize content delivery and level up your website performance. If you wish to learn more about Azure CDN and how to develop skills to leverage this technique with a breeze or better understand the utility of CDN Azure, we recommend you to have a look at our training programs and resources. 

Whizlabs offers myriad Azure courses and certifications to help you become a pro at using Azure resources and make the best of Azure CDN to improve business outcomes while winning over customers. You will find practice papers, video lectures, hands-on labs, and an Azure sandbox designed explicitly by subject-matter experts. Reach out to us to discover more!

About Vidhya Boopathi

Vidhya is a Senior Digital Marketing Executive with 5 years of experience. She is skilled in content creation, marketing strategy, digital marketing, social media, website design, and creative team management. Vidhya pursued her Master's Degree in computer science engineering, making her an expert in all things digital. She always looking for new and innovative ways to reach her target audience.
Scroll to Top