CDN (CONTENT DELIVERY NETWORK) to speed up your websites – Web optimization (Tips and Best Practices)


CDN should be used to speed up the loading of your favorite javascript  libraries. CDN stands for Content Delivery Network. This is network of servers that store commonly used libraries across wide range of locations.

For example, Google has stored copies of common javascript libraries on CDN. So it is recommended to link to Google’s  javascript library instead of downloading and using your own copy of javascript library.

Web works by sending and receiving packets of information across various physical locations. The closer user is to your server, the faster the data get to them.  CDN hosts multiple copies of files across different location. User’s will always have access to the one that is closest to them.

Yahoo’s Developer Network, Google and also others recommend use of CDN.

Yahoo has provided excellent best practices on speeding up website at URL

Here one of the best practices is to always use content delivery network.

Since browser cache javascript file, if a user visits a website that links to Google CDN and after that user visit another website which also has link to Google CDN; the second website will have advantage of library that is already being cached in computer.

Since google copies of jQuery are very popluar, there is more probability that google’s CDN copy of jquery library is already loaded in visitor’s computer when they visit your website.

Google CDN source:

To use Google CDN, go to URL

Here you can find links of popular libraries including jQuery. For Example, we can use highlighted link (refer above graphic) to include jQuery library in source code.

Couple of problems with Google CDN that you must know:
Though Google CDN are more reliable than most servers , if there is connection problem with CDN then your script that is linked to Google CDN will not load.

You might be developing code on local machine without connection to internet. If your code has link to jQuery libraries from CND then your script that depend on jQuery will not load. And you will not be able to test your code.

Fixes to this is, we can have links to Google or Other CDN but we should also have back-up copies of those libraries on local drives.

This entry was posted in Web Application Development and tagged . Bookmark the permalink.

Comments are closed.