What is a CDN (Content Delivery Network)?

Speed Up Your Web Pages By Caching Files at the Network Level

CDN stands for “Content Delivery Network” and it is a system of computers with scripts and other content on them that are widely used by many web pages. A CDN can be a very effective way to speed up your web pages because the content will often be cached at a network node.

How a CDN Works

  1. The web designer links to a file on a CDN, such as a link to jQuery.
  2. The customer visits another website that also uses jQuery.
  1. Even if no one else has used that version of jQuery, when the customer comes to the page in number 1, the link to jQuery is already cached.

But there is more to it. Content Delivery Networks are designed to be cached at the network level. So, even if the customer does not visit another site using jQuery, chances are that someone on the same network node as they are on has visited a site using jQuery. And so the node has cached that site.

And any object that is cached will load from the cache, which speeds up the page download time.

Using Commercial CDNs

Many large websites use commercial CDNs like Akamai Technologies to cache their web pages around the world. A website that uses a commercial CDN works the same way. The first time a page is requested, by anyone, it is built from the web server. But then it is also cached on the CDN server. Then when another customer comes to that same page, first the CDN is checked to determine if the cache is up-to-date.

If it is, the CDN delivers it, otherwise it requests it from the server again and caches that copy.

A commercial CDN is a very useful tool for a large website that gets millions of page views, but it might not be cost effective for smaller websites.

Even Smaller Sites Can Use CDNs for Scripts

If you use any script libraries or frameworks on your site, referencing them from a CDN can be very useful.

Some commonly used libraries that are available on CDN include:

  • Chrome Frame
  • Dojo Toolkit
  • Ext JS
  • jQuery
  • jQuery UI
  • MooTools
  • Prototype
  • Script.actulous
  • swfObject
  • Yahoo User Interface (YUI)

And ScriptSrc.net provides links to these libraries so you don’t have to remember them.

Small websites can also use free CDNs to cache their content. There are several good CDNs you can use, including:

When to Switch to a Content Delivery Network

The majority of response time for a web page is spent downloading the components of that web page, including images, style sheets, scripts, Flash, and so on. By putting as many of these elements as possible on a CDN, you can improve the response time dramatically. But as I mentioned it can be expensive to use a commercial CDN. Plus, if you aren’t careful, installing a CDN on a smaller site can slow it down, rather than speed it up. So many small businesses are reluctant to make the change.

There are some indications that your website or business is big enough to benefit from a CDN.

  • your site gets a lot of visitors every day
  • and those visitors come from a widely distributed area

Most people feel that you need at least a million visitors per day to benefit from a CDN, but I don’t think there is any set number.

A site that hosts a lot of images or video could benefit from a CDN for those images or videos even if their daily page views is lower than a million. Other file types that can benefit from being hosted on a CDN are scripts, Flash, sound files, and other static page elements.