Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

Part 99 - What is CDN - Content Delivery Network

Suggested Videos 
Part 96 - LoadingElementDuration property of AjaxOptions class
Part 97 - Implement autocomplete textbox functionality in mvc
Part 98 - What is JavaScript minification



CDN stands for Content Delivery Network. CDN is a network of computers that exist all over the world. For a web application there are 2 ways we can make the jQuery library available



1. Have a copy of the jQuery library on your web server and reference it
<script src="~/Scripts/jquery-1.7.1.min.js" type="text/javascript">
</script>
2. Reference the jQuery library from a CDN. (Microsoft, Google, or jQuery)
<script src="http://code.jquery.com/jquery-1.7.1.min.js" type="text/javascript">
</script>

Google CDN: http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
Microsoft CDN: http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js
Jquery CDN: http://code.jquery.com/jquery-1.7.1.min.js

Benefits or advantages of using a CDN:
1. Caching benefits - If other web sites use jquery and if the user has already visited those websites first, jquery file is cached. If the user then visits your website, the cached jquery file is used without having the need to download it again.

2. Speed benefits - The jquery file from the nearest geographical server will be downloaded.

3. Reduces network traffic - As the jQuery file is loaded from a CDN, this reduces the network traffic to your web server.

4. Parallelism benefit - There is a limitation on how many components can be downloaded in parallel. This limitation is per  hostname. For example, 
1. If the browser allows only 2 components to be downloaded in parallel per hostname and 
2. If a web page requires 4 components and 
3. If all of them are hosted on a single host and 
4. If 2 components take 1 second to download
Then to download all the 4 components, it is going to take 2 seconds.

However, if 2 of the components are hosted on a different host(server), then all the 4 components can be downloaded in parallel and in 1 second.

No comments:

Post a Comment

It would be great if you can help share these free resources