Want to speed up your website use a CDN for commonly used files

Introduction

Serving
files from a website is easy just link to them and you’re done.
Serving files from your website in the most optimal way isn’t that easy, first
you have to think about things like making sure that the caching is right and
if the files are being used a lot on other sites.

If files
are being used a lot on other sites then it could be that the user already has
a copy of this file lying around, let’s say you use jQuery on your site. You’re
not the only one using this library there are a lot of other websites that are
using this library which means that the people coming to your site might
already have jQuery running, to make sure these people don’t need to get yet
another copy of jQuery this can be

The
advantages

Localized
delivery: people in America will get it from local servers and so will people
from Europe or Asia

Cached
delivery: people who already have gotten the CDN version of that library won’t
need to download it again.

It’s free:
it actually costs your server a bit of time to handle the requests, it also
costs you a bit of bandwidth it costs you nothing to use a CDN.

The players

Google
Libraries
which has:

Chrome Frame
Dojo
Ext Core
jQuery
jQuery UI
MooTools
Prototype
script_aculo_us
SWFObject
Yahoo! User Interface Library (YUI)
WebFont Loader

Microsoft
Ajax Content Delivery Network
has:

ASP.NET Ajax 
jQuery  
jQuery UI  
    jQuery Validation
    jQuery Mobile
    jQuery Templates
    jQuery Cycle
    Modernizr
    Ajax Control Toolkit 
    ASP.NET MVC 

CDN JS has
even more libraries out there which the other ones don’t have examples:
coffee-script
json2
less.js
require.js

Exceptions

There are a
couple of reasons not to use a CDN in specific circumstances.

Local
applications hosted on a network: it’s always good in these cases to use local
files because you don’t need the internet to run this application.

When
combining compressing your JavaScript files: if you have a lot of JavaScript
files then it is best practice to combine and minify these files in some cases
this can render better results than using a CDN.

Conclusion

It’s almost
always good to use a CDN, above is a list of CDN’s which are widely used and
reliable so there is no excuse not to use these.

 

 

 

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>