Someday when your business extends from smaller region to all over the world then your business website will be viewed by people all over the world. When you had a small business and your site was hosted at only one place that was fine but now, when it is viewed by people across seas do you think your site will be fast? The answer is NO, because as area increases the distance to be traveled by the files and folders of your site increases which obviously increases the page loading time,latency and sometimes due to routing issues those files may not reach its point and your website may not be displayed. For this there is a solution too and it is CDN(Content Delivery Network).
What is CDN?
CDN(Content Delivery Network) is a network placed in different parts of the world which contains files of the website. When a website is requested instead of travelling miles, nearest network would be approached and website will be loaded fast and also routing issues will be avoided. For example an Indian based website is accessed some where in new york and the site is also hosted in New Jersey, instead of travelling all the distance from India to new york, the site’s file will be transferred from new jersey to new york avoiding all the routing and other issues. It is like servers holding your files across the globe , reachable to all the people around the world and makes sure that your website is loaded fast and these servers are called “edge servers”.
How it works?
The working of a CDN under goes following steps:
- When a browser sends a request for a domain name, that is a DNS request is made.
- The server which is handling DNS requests will check for the domain name and sends back the IP address for the edge server which is closer to the area from where the request has been made.
- These Edge Servers are proxy caches similar to browser caches. When a request comes to the edge server it checks for the cache and see if the content is present or not.
- If the content is present and cache is not expired, the content will be displayed directly from the edge server.
- If the content is not present then the edge server makes a request to the origin server. The origin server is the true server of the website and is capable of providing the information available in CDN.
- As soon as the origin server sends the content, the edge server stores info in a cache based http header of response and also display the information to the browser.
- Once again when your request, if the cache is not expired the content will be directly displayed from edge servers rather than fetching content from origin server.
Origin Server and Edge Server:
The Edge servers just responds to the request and displays accordingly but the origin servers are being runned by technologies like java, .net or any other and hence any changes can be done in the origin server unlike edge servers are just having a copy of data present it origin server and cannot be changed. CDN is just a cache, if the data is always fetched from the origin server then there is no value for CDN. When an edge server makes a request to origin server then there is no value of CDN there and instead it costs more and takes longer time.This is the reason why all the java script,CSS, image files are served from data as they don’t change frequently.
How to setup?
No matter what ever CDN you are looking for, there are mainly 5steps common in setting up CDN. They are:
- Sign Up:
- If you have been recommended some site for CDN, just go to that site and sign up for their service. In our case we prefer and suggest Cloudflare, so just get into its site and sign up.
- Getting Files into the CDN:
- Decide your url names:
When we provide the url names at the time of entering file to CDN they change once added in CDN. For example if xyz.com/css/home.css was you css file name, after adding in CDN it will change to gf455633jhk/home.css and this doesn’t look nice. So you can change them to cdn.xyz.com/home.css.
- Make sure that right files are called:
You can check this through wordpress or CMS. You can just ask the CMS to swap the files using caching systems.
You can test your site fro different locations by using webpagetest.org .
Cloudflare helps in protecting and acceleration your online website. It automatically optimizes the delivery of web page and helps your site to load faster. Before your page displays, the cloufare filters bots and other atackers before they attack your website. It is also very user friendly i.e., comfortable in changing the settings and easy to understand. It also provides many other features. To know more about Cloudflare Click Here: CloudFlare Overview
Benefits of CDN:
- Loading time is faster.
- Gives better performance.
- Gives a better user experience.
- Improves site ranking.
- Protection against surge in traffic.
- Protection against Dos.
The importance of CDN will grow day by day as it plays a vital part in the internet. Even now many companies are trying to make advancement in the edge servers and provide the users fastest loading experience.Having a good knowledge about CDN and hoe they work helps in giving users a better experience of your website.
Host Department is offering free cloudFlare and Softaculous with cPanel control Panel for unlimited web hosting plans starting from $2.95/per Month