What is a CDN and how does it work?

January 11, 2018

Author: Nadine Winkler

Write a comment

While broadband connections still aren’t as advanced as they should be in some parts of the world, it’s safe to say that internet-based data transfer has made huge strides. Remember the old 33.6 modems that we used to use to access the internet? You could pop out for a coffee in the time it took for a website to load! Fortunately, that’s all in the past and today’s well optimized websites can be loaded and displayed in milli-seconds. Thanks to 4G and LTE, data transfer has got a lot quicker on mobile devices too. Today, users expect content to be immediate and analytics tools can show how bounce rates increase when websites take too long to load.

We also shouldn’t forget that Google has made website speed a key ranking factor. And rightly so, since Google’s self-stated aim is to present users with the best websites possible when responding to their searches – and that includes user experience. Slow loading websites certainly do not contribute to a positive UXP.

We’ve discussed what you can do to optimize page-speed before on the XOVI Blog, but a CDN can also help. A what? Well, read on.

What’s a CDN?

A Content Delivery Network is a network which delivers content. The clue’s in the name. So why is that useful for your website?

A typical use of a CDN is when displaying images. The idea is that large image files aren’t stored on your own server but on a network of servers spread all over the world, where users can access them from there. Images are then simply embedded on your website like any external source, saving valuable resources.

Here are a few examples of what can be hosted on a CDN:

  • Images: PNG, JPG, SVG, GIF, TIF
  • Style sheets: CSS
  • JavaScript: JS
  • Video/Audio: FLV (Flash), HLS, MP4 (HTML5 Videos), MOV (QuickTime), WMV (Windows Media), MP3 und WAV
  • Web fonts: EOT, TTF, OTF, CFF, AFM, LWFN, FFIL, FON, PFM, PFB, WOFF, SVG, STD, PRO, XSF, und viele mehr
  • Other file formats: HTML, JSON, PDF, DOC, PPT, XLS, EPUB, ODT, ODP, ODS, TXT, RTF, ZIP

Unlike TV or radio, data on the internet isn’t “sent” but rather called up by browsers from servers. If you don’t have a CDN, requests from all over the world come to just the one server where data is hosted. Such is way the internet is constructed, these requests don’t all come via direct routes but via various different hubs. Processing these requests therefore obviously takes time and it can sometimes be a while before information is fully visible to users on their browsers.

A CDN, on the other hand, delivers files from the server which can provide them the quickest, wherever it happens to be located, thus avoiding long load times and distributing high visitor numbers more evenly. This has a positive effect on load times.

As a webmaster, put all your images on an original server. Copies will then be made and stored on servers connected to the network and distributed from there.

CDN Server
Simplified display of CDN Server distribution

Another advantage of a CDN is that the server generally delivers files from the server closest to the user. For a single-language blog or niche website, this isn’t particularly relevant, but it can be extremely important for multi-language, international e-commerce websites. In such cases, images are delivered to North American users from a server in North America, to users in Europe from a European server and to Australian users from a server down under. Obviously it all depends on the size of the server too but the idea is to keep the routes between server and user as short as possible, thus reducing load times.

Advantages of a CDN:

  • Better load times
  • Greater stability
  • Save on cost of hosting yourself
  • Added analysis options thanks to CDN provider statistics

Of course, a CDN isn’t a magic cure and, like anything, there are a few cons to add to the pros …

Disadvantages of a CDN:

  • Greater complexity: Both setting up a CDN and maintaining it obviously requires more time and effort than a single server.
  • Security issues: More servers = more opportunities for hackers. JavaScript files are particularly popular targets for hackers.
  • Loss of control: Since files are no longer stored on your own server, this naturally entails a certain loss of control over them. If, for whatever reason, you don’t want your files to be hosted in the USA, it’s not something you can control.

How much does a CDN cost?

CDN costs can vary greatly, from free solutions such as Cloudflare or the Google App Engine, to more expensive options. However, the offers are actually designed for entire web applications. Static content can also be saved there.

One of the most popular pay-services is KeyCDN.com. Cost is generally calculated by data volume and KeyCDN customers pay, for example, 0.04 USD per gigabyte for the first ten terabytes. Bigger websites require bigger solutions.

Should I consider using a CDN?

Websites with particularly heavy traffic should certainly consider using a CDN in order to distribute traffic more evenly. Websites with a high number of files (videos or audio clips) could also benefit from a CDN. As mentioned above, CDNs are also particularly useful for websites whose visitors come from many different countries or regions. Here, the CDN delivers data from the nearest geographical location.

Author: Nadine Winkler