In this short post, let’s try to know about the basic concepts related to Azure Content Delivery Network.
What is it?
So, Why we use it ? The reason is efficient delivery of contents with least possible latency. How ?
A content delivery network (CDN) is distributed network of servers, that can efficiently deliver web contents to the users. The efficient delivery is ensured by the caching the contents on edge servers in point-of-presence (POP) locations that are close to end users, to minimize latency.
Azure Content Delivery Network (CDN) offers developers a global solution for rapidly delivering high-bandwidth content to users by caching their content at strategically placed physical nodes across the world. Azure CDN can also accelerate dynamic content, which cannot be cached, by leveraging various network optimizations using CDN POPs.
How it works ?
Let’s quickly try to understand how CDN helps in delivering the contents efficiently.
Let’s assume you have a web application deployed on a server and it serves some pics of famous tourist locations. People all over the world use your application.
If you do not decide to use a CDN, then the time required to serve the images would be different for people from different regions. The people located geographically closer to the web app server’s location, would get contents faster, while the people who are farther from the server might think that the application is slow because the time for showing contents is higher for them.
So, let’s say you decide to use the Azure CDN. Then below is the sequence of actions:
- The URLs for images are specified like https://<domain>>.azureedge.net/somefile in the application.
- A user tries to access the application, causing the http requests for images to be sent to nearest The requests for images go to the nearest best performing POP (Point of Presence) location.
- If no edge servers in the POP have the file in their cache, the 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.
- The origin server returns the image to POP.
- The image is cached at POP. The cache duration is specified by the TTL (Time to live) header. If it is not specified, then default duration is 7 days.
- When multiple users tries to access the same image with same URL, the request goes to best performing POP.
- If the TTL for the file is not expired yet, the POP will serve the file, without going to the origin server.
I hope you found this information useful. Let me know your thoughts.