“CDN- Content Delivery Network is a network of geographically dispersed servers which delivers cached content of a site like the images, CSS/JS files and other structural components from websites to end users based on the geographic location of the user.”
The goal of a CDN is to serve content to end-users with high availability and high performance.
For example: If your main server is hosted in India, and someone from Durham, England tries to access it, then they will be redirected to the closest server which may be in London. This reduces latency and provides a faster loading of your website.
CDNs not only ensure a faster experience to your users, but they also help to prevent site crashes in the event of traffic surges – CDNs help to distribute bandwidth across multiple servers, instead of allowing one server to handle all traffic.
Why do I need a CDN? –
The most important reason for using a CDN is to improve your user’s experience in terms of speed.
- It increases the parallelism available –>Most browsers will only download 3 or 4 files at a time from any given site.
- It increases the chance that there will be a cache-hit–> As more sites follow this practice, more users already have the file ready.
- It ensures that the payload will be as small as possible–> Google can pre-compress the file in a wide array of formats (like GZIP or DEFLATE). This makes the time-to-download very small, because it is super compressed and it isn’t compressed on the fly.
- It reduces the amount of bandwidth used by your server–>Google is basically offering free bandwidth.
- It ensures that the user will get a geographically close response–> Google has servers all over the world, further decreasing the latency.
There are several scenarios when you might not want to use CDN:-
- When you are building an intranet application where the webserver is hosted on the same network as the clients.–> If you use CDN ,you will be making a call to the internet rather than a webserver on the local network. This increases bandwidth for your organization, and is slower.
- When you want to run your application offline
- When you need to customize it
Following are the three popular jQuery CDNs-
Below is the code to load jQuery from all 3 CDNs.
For more info please visit- http://gtmetrix.com/why-use-a-cdn.html
Programming is Easy…