Showing posts with label Azure CDN. Show all posts
Showing posts with label Azure CDN. Show all posts

Saturday, June 11, 2016

Purge Azure CDN Endpoint

Due to updates to your web application, or to quickly update assets that contain incorrect information.Sometimes you may wish to purge cached content from all edge nodes and force them all to retrieve new updated assets. 
To handle aforementioned scenario the term we use to describe this technology is Purging.Purging particular asset on Azure CDN deletes the cached version of that asset from all Edge servers on the Azure CDN. For example, if you have updated an image, or have made changes to your CSS file. Purging Azure CDN asset prevents an old version of an asset from being delivered to your clients.

Microsoft wasn't supporting the conventional way of purging the content, which intern was really difficult for customer to achieve.Under past procedure you had to contact Microsoft Support and create a ticket to purge the edge servers.Say for an example you have hosted the videos on Azure CDN and because the process was so clumsy with support tickets to force a purge on servers around the world, people would rather uploaded a file with a new name and changed the web page to point to the new file.Or best They will go with Short TTL as an Alternative to Purge.

Using Azure Portal


The support has recently been made available to Azure ARM Portal-
  • In the Azure Portal, browse to the CDN profile containing the endpoint you wish to purge.
  • From the CDN profile blade, click the purge button.


  • On the Purge blade, select the service address you wish to purge from the URL dropdown.


  • Select what assets you wish to purge from the edge nodes. If you wish to clear all assets, click the Purge all checkbox. Otherwise, type the full path of each asset you wish to purge (e.g., /pictures/test.png) in the Path textbox.
  • Click the Purge button.



Using PowerShell

Get-Command -Module AzureRM.Cdn 
To invoke the purge make use of Unpublish-AzureRmCdnEndpointContent
Unpublish-AzureRmCdnEndpointContent `  
    -ResourceGroupName $ResourceGroupName `
    -ProfileName $ProfileName `
    -EndpointName $EndpointName `
    -PurgeContent = '/*'
With endpoint object in hand
$endpoint = Get-AzureRmCdnEndpoint -ResourceGroupName $ResourceGroupName `
    -ResourceGroupName $ResourceGroupName `
    -ProfileName $ProfileName `
    -EndpointName $EndpointName

$endpoint | Unpublish-AzureRmCdnEndpointContent -PurgeContent = '/*'
Related Articles : Solutions In Azure: Azure CDN

Wednesday, May 11, 2016

Solutions in Azure : Azure CDN for Maximum Bandwidth & Reduced Latency - Part II

From First Part of the Article we can derive a conclusion that the CDN’s job is to enhance your regular hosting by reducing bandwidth consumption, minimizing latency and providing the scalability needed to handle abnormal traffic loads. It cuts down on round-trip time (RTT), effectively giving similar response to end user irrespective of their geographical presence.

In MicroMarketMonitor’s recent report, it has clearly mentioned that only the North American content delivery network market is expected to grow from $1.95 billion in 2013 to $7.83 billion in 2019. One significant factor driving this growth is end user interaction with online content. So moving forward its gona be a major factor while architecting any only application--

Azure CDN Highlights


1. Improve rendering speed & Handle high traffic loads
Azure CDN servers the content by making use of its large network of POPs. This dramatically increases the speed and availability, resulting in significant user experience improvements.
2. Designed for today’s web
Azure CDN is specifically designed for the dynamic, media-centric web of today—and cater to the requirement of its users who expect everything to be fast, high quality, and always-on. 
3. Streaming Aware Era
Azure CDN can be helpful under all possible three ways while serving videos over HTTP- Progressive Download and Play, HTTP Pseudostreaming & Live Streaming. 
4. Dynamic Content Acceleration
If you understand the nitty-gritties of Azure CDN it also uses series of techniques to serve uncatchable content faster. For example, it can route all communication from a client in India to a server in the US through an edge in India and an edge in the US. They then maintain a constant connection between those two edges and apply WAN optimization techniques to accelerate it. 
5. Block spammers, scrapers and other bad bots
Azure Content Delivery Network is built on a highly scalable, reverse-proxy architecture with sophisticated DDoS identification and mitigation technologies to protect your website from DDoS attacks. 
6. When the expectations are at peak, Azure CDN delivers
Thanks to its distributed global scale, Azure Content Delivery Network handles sudden traffic spikes and heavy loads, like the start of a major product launch or global sporting event.

Working With Azure Storage


Once the CDN is enabled on an Azure storage account, any blobs that are in public containers and are available for anonymous access will be cached via the CDN. Only blobs that are publicly available can be cached with the Azure CDN. To make a blob publicly available for anonymous access, you must denote its container as public. Once you do so, all blobs within that container will be available for anonymous read access. You have the option of making container data public as well, or restricting access only to the blobs within it.

For best performance, use CDN edge caching for delivering blobs less than 10 GB in size.
When you enable CDN access for a storage account, the Management Portal provides you with a CDN domain name in the following format: http://.vo.msecnd.net/. This domain name can be used to access blobs in a public container. For example, given a public container named music in a storage account named myaccount, users can access the blobs in that container using either of the following two URLs:
  • Azure Blob service URL: http://myAccount.blob.core.windows.net/music/
  • Azure CDN URL: http://.vo.msecnd.net/music/

Working With Azure Websites


You can enable CDN from your websites to cache your web contents, such as images, scripts, and stylesheets. See Integrate an Azure Website with Azure CDN.
When you enable CDN access for a website, the Management Portal provides you with a CDN domain name in the following format: http://.vo.msecnd.net/. This domain name can be used to retrieve objects from a website. For example, given a public container named cdn and an image file called music.png, users can access the object using either of the following two URLs:

  •  Azure Website URL: http://mySiteName.azurewebsites.net/cdn/music.png
  • Azure CDN URL: http://.vo.msecnd.net/cdn/music.png

Working With Azure Cloud Services


You can cache objects to the CDN that are provided by an Azure cloud service. Caching for cloud services has the following constraints:
  • The CDN should be used to cache static content only.
  • Your cloud service must be deployed to in a production deployment.
  • Your cloud service must provide the object on port 80 using HTTP.
  • The cloud service must place the content to be cached in, or delivered from, the /cdn folder on the cloud service
When you enable CDN access for a cloud service, the Management Portal provides you with a CDN domain name in the following format: http://.vo.msecnd.net/. This domain name can be used to retrieve objects from a cloud service. For example, given a cloud service named myHostedService and an ASP.NET web page called music.aspx that delivers content, users can access the object using either of the following two URLs:
  •  Azure cloud service URL: http://myHostedService.cloudapp.net/cdn/music.aspx 
  • Azure CDN URL: http://.vo.msecnd.net/music.aspx

Accessing Cached Content over HTTPS

Azure allows you to retrieve content from the CDN using HTTPS calls. This allows you to incorporate content cached in the CDN into secure web pages without receiving warnings about mixed security content types.

To serve your CDN assets over HTTPS there are couple of constraints worth mentioning:

  • You must use the certificate provided by the CDN. Third party certificates are not supported.
  • You must use the CDN domain to access content. HTTPS support is not available for custom domain names (CNAMEs) since the CDN does not support custom certificates at this time.

Even when HTTPS is enabled, content from the CDN can be retrieved using both HTTP and HTTPS.

Note: If you've created a CDN for an Azure Cloud Service (e.g. http://[XYZ].cloudapp.net/cdn/) it's important that you create a self-signed certificate for your Azure domain ([XYZ].cloudapp.net). If you're using Azure Virtual Machines can be done through IIS.

Custom Domain to Content Delivery Network (CDN) endpoint

In case you want to access the cached content with custom domain, azure lets you map your domain to particular CDN End point. With that in place you can use your own domain name in URLs to retrieve the cached content.

For detailed information on implementation please check- Map CDN to Custom Domain

CDNs are an essential part of current generation’s Internet, and they’re only going to become more important as time goes on. Even now, companies are hard at work trying to figure out ways to move more functionality to edge servers (POP Locations) in order to provide users with the fastest possible experience. Azure CDN plays a vital role as it suffice current generation CDN requirement. While implementing Azure CDN (Or any CDN for that matter) the important thing is to formulate a strategy regarding the maximum lifespan of an object beforehand.

P.S.: As of Now you can't use your own custom domain or SSL Certificate with Azure CDN, But that support will eventually be coming.

Related Articles : Solutions In Azure: Azure CDN


Thursday, April 28, 2016

Solutions in Azure : Azure CDN for Maximum Bandwidth & Reduced Latency - Part I

Under the Current Eco System of Microsoft Cloud; Azure CDN has been widely recognized as CDaaS (Content Delivery as a Service), with its growing network of POP locations it can be used for offloading content to a globally distributed network of servers. As its prime functionality it caches static content at strategically placed locations to help distributing Content with low latency and higher data transfer that ensures faster throughput to your end users. 



Azure CDN particularly offers a global solution to the developers for delivering high-bandwidth content by caching the content at physical nodes across the world. Now requests for these contents has to travel shorter distance reducing the number of hops in between. With CDN in place you can be ensured that Static files such as (images, JS, CSS, videos etc.) and website assets are sent from servers closest to your website visitors. For content heavy websites like e- commerce this latency savings could be of significant performance factor. 



In essence, Azure CDN puts your content in many places at once, providing superior coverage to your users. For example, when someone in London accesses your US-hosted website, it is done through an Azure UK PoP. This is much quicker than having the visitor's requests, and your responses, travel the full width of the Atlantic and back. 

There are two players (Verizon & Akamai) to provide us those edge locations for Azure CDN. Both providers have distinct ways of building their CDN infrastructures. Verizon on one hand has been quite happy disclosing their location on the contrary Azure CDN from Akamai POP locations are not individually disclosed. To get the updated list of locations keep checking Azure CDN POP Locations.

How Azure CDN Works

Today, over half of all internet traffic is already being served by CDNs. Those numbers are rapidly trending upward with every passing year, and azure has been significant contributor there. 




As with most of the azure services, Azure CDNs are not magic and actually work in a pretty simple and straightforward manner. Let’s just go through the actual case- 
  1. A user (XYZ) requests a file (also called an asset) using a URL with a special domain name, such as .azureedge.net. DNS routes the request to the best performing Point-of-Presence (POP) location. Usually this is the POP that is geographically closest to the user. 
  2. If the edge servers in the POP do not have the file in their cache, the edge server requests the file from the origin. The origin can be an Azure Web App, Azure Cloud Service, Azure Storage account, or any publicly accessible web server. 
  3. The origin returns the file to the edge server, including optional HTTP headers describing the file's Time-to-Live (TTL). 
  4. The edge server caches the file and returns the file to the original requestor (Alice). The file will remain cached on the edge server until the TTL expires. If the origin didn't specify a TTL, the default TTL is 7 days. 
  5. Additional users (ex. ABC) may then request the same file using that same URL, and may also be directed to that same POP. 
  6. If the TTL for the file hasn't expired, the edge server returns the file from the cache. This results in a faster, more responsive user experience. 
Reasons for using a CDN

  • To understand the reasons behind why Azure CDN is so widely used, we first have to recognize the issue they're designed to solve (LATENCY). It's the annoying delay that occurs from the moment you request to load a web page to the moment its content actually appears onscreen, especially applications where many “internet trips” are required to load content. There are quite a few factors which contribute to this, many being specific to a given web page. In all cases however, the delay duration is impacted by the physical distance between you and that website's hosting server. Azure CDN's mission is to virtually shorten that physical distance, the goal being to improve site rendering speed and performance.
  • Another obvious reason for using the Azure CDN is throughput. If you look at a typical webpage, about 20% of it is HTML which was dynamically rendered based on the user’s request. The other 80% goes to static files like images, CSS, JavaScript and so forth. Your server has to read those static files from disk and write them on the response stream, both actions which take away some of the resources available on your virtual machine. By moving static content to the Azure CDN, your virtual machine will have more capacity available for generating dynamic content.

When a request for an object is first made to the CDN, the object is retrieved directly from the Blob service or from the cloud service. When a request is made using the CDN syntax, the request is redirected to the CDN endpoint closest to the location from which the request was made to provide access to the object. If the object is not found at that endpoint, then it is retrieved from the service and cached at the endpoint, where a time-to-live (TTL) setting is maintained for the cached object.

Related Articles : Solutions In Azure: Azure CDN