Any experienced website owner will be so familiar with the idea that performance and low-latency are good things that it seems almost condescending to point it out. And yet, every year millions of dollars in potential income from advertising revenue and sales are lost because solo site owners and SMEs aren’t investing sufficient time and effort to ensure that their sites are fast enough to provide a good experience for users.
Most of us are using a content management system of some sort, whether that’s WordPress, Joomla!, or Drupal, all of which need a helping hand when it comes to delivering assets as quickly as possible. That’s usually accomplished with some form of caching, but no amount of on-server caching is going to help a site overcome the laws of physics.
The greater the geographic distance between the server and the client’s web browser, the longer it takes for information to get where it needs to be. We have to account for the time it takes for requests to travel from the browser to the server and then back again — the round-trip time. We also have to consider that no packet travels a straight line between those two points — they pass through routers and switches on the way, each of which adds precious milliseconds to the time it takes for a page to load.
The solution to the problem of latency introduced by long-distance travel through a network is the content distribution network.
A CDN is a form of caching, but rather than caching resources in memory on a site’s web server or a local caching node, they are sent ahead of time to a network of servers — known as edge nodes — located around the world. Instead of being loaded from your server, assets are loaded from the nearest edge node.
Image this scenario: an image on your site appears on the front page of Reddit. Thousands of people from all around the world hit your server every time someone checks it out. Even assuming your server can cope with the load, people from the other side of the world are going to be waiting a long time before the image loads, simply because of their distance from the server. Since the average internet user is an impatient creature, a non-trivial proportion are not going to wait for pages to load. They will abandon the page, and your site will lose the opportunity to gain new readers and any revenue they might have generated.
If your site was hooked into a content distribution network, the situation would have played out differently. There are two ways a CDN can help:
By loading resources from edge nodes rather than from the home server, the load on the server is substantially reduced, helping a site survive traffic spikes and maintain a reasonable level of performance.
Because assets are loaded from nearby edge nodes, they have to travel a shorter distance — they’ll load much faster for visitors than if they were always served from a site’s home server.
It’s easy to integrate a content distribution network with all modern content management systems, so, if your site’s revenue depends on happy users — which it does — there’s no good reason not to use a CDN.