Content Delivery Network

A very Basic Definition of CDN: It’s a network who Delivers contents.

It’s not a very new concept for most of the readers and most of them might be using in real life.

So, To begin with, a very basic thing (Why CDN and what value it can add) which always comes in the mind for someone who is new to CDN concept and curious to know, like me 🙂

The below diagram is the typical old fashioned way of network configuration. The original server is responsible for serving all the request which is not an issue for small setup or application where the application does not have many visitors. But what can possibly happen if tons of the visitors frequently visiting? What will happen to site performance?  

 

2017-07-27 12_06_10-What-is-Client-Server-Architecture-Hindi.jpg (409×333)

Why CDN and what value it can add:  

Using a Content Delivery Network can speed up your website for visitors, it can also significantly reduce the load on your web server.

CND distributes the static content of the websites like pictures, images, videos and put them to the location closer to the people you are serving the content. These services have the server all over the world and they cash the content to those servers and when the person visits your site those services will load the content from those change server nods instead of your personal server. This approach will take the load from your web server and distribute to other servers.

 

2017_07_27_11_47_12_Content_Delivery_Network_Built_for_the_Future_KeyCDN

To explain a bit more,  The web server or Original server is the top or root of the tree. Now the implementation of the CDN on top of that you can use the DNS record for your content delivery network.

Type of the content delivery network 

  • Pull 
  • Push 

Pull: Can also be called on demand, that means someone has to request for the resources. Example for the very first request from the customer, CDN will first check if the content can be served or available in CDN nodes. If not it will go to the original server and pull content from the original server and distribute requested content across the CDN modes to serve locally.  The very first request may bit slow Initially.

With Pull, the CDN determines if the content will need to be pulled from the Original Server via the “Cache-Control” headers configured on the web server.  Use of the ”private” and “no-cache” option in the Cache-Control headers will result in the CDN pulling a new version of the content for each request it receives as the headers will instruct it not to cache that content.

It’s also important to know that the pull option has TTL ( Time to Live )  / max-age features. It’s limit the lifetime of the data in the CDN network configuration. It’s not a recommended practice to configure less than 5 to 10 minutes for as this will put excessive load on your web server and result in less optimal performance. Be aware that if the content on the web server has been updated, each POP will continue to serve the old cached version until that cache is purged or the cache on the POP expires. If no max-age header is set, the default max-age of 24 hours will be used.

Push:  That means you are pushing your static contents to Content Delivery Network

Example: If you are uploading an image into the Original server, you will push that image to content delivery network and than CDN will take that image and cache it across the other servers.

Now we have all the content to be severed across all network

How CDN server will recognize the request and serve the content fast 

when the request comes, CDN recognizes the nearest location by DNS from where the request is coming. When a request comes it can be from anywhere (across the street or anywhere in the world). CDN recognize the DNS where the request is coming from and then CDN finds the nearest node to the location and load the content from that nearest Node. It will make the content serve very fast

I remember few CDN providers name but there are lot more which I don’t remember

Amazone

Akamai

Rackspace

CloudFlare

Maxcdn

CDN will mirror what is in Original Webserver and cache into multiple locations around the world. The content is served from the nearest geographic location which makes website load fast.

But this is not the case every time you would like to use cached data. The specific requirement where you would not like to catch data. For Example Sitecore Personalization.

For achieving this the 2 option can be considered

  1. This needs customization where you can create a rule in CDN server to not to cache that particular URL or type of the URL. Example URL with specific query string. But that need code change in web server.
  2. Via Cache-Control” headers configured on the web server in pull CDN. The use of the ”private” and “no-cache” option in the Cache-Control headers will result in the CDN pulling a new version of the content for each request it receives as the headers will instruct it not to cache that content.

My next post will continue about the CDN and Azure.

 

 

 

 

 

 

 

2 thoughts on “Content Delivery Network

  1. Hi, Neat post. There is a problem with your web site in internet explorer, would test this?IE still is the market leader and a good portion of people will miss your fantastic writing because of this problem.

    Like

Leave a comment