TERM · WEB

Content delivery network (CDN)

What is a content delivery network (CDN)?

A content delivery network (CDN) is a set of servers spread across many cities that keep copies of a site’s files and hand each visitor the copy nearest to them. Images, stylesheets and scripts travel a shorter distance, and the site’s own server does less work. The gain grows with distance: a shop whose customers and server are in the same country gains far less than one selling across Europe.

Example

An online shop in Ruse sells in Bulgaria and in Germany, and its server is in Bulgaria. Before a page can start to load, the browser and the server trade messages several times — to open a connection, to agree on encryption, to ask for the page — and each exchange covers the full distance. Say one exchange takes 10 ms for a customer in Plovdiv and 50 ms for a customer in Hamburg (illustrative figures). Three exchanges cost 30 ms against 150 ms, before a single photo has arrived.

With a CDN, copies of the shop’s photos, stylesheets and fonts also sit on a server in Frankfurt. The page itself, if it is not cached, still comes from Bulgaria, but everything it asks for next reaches the customer in Hamburg from much closer. The customer in Plovdiv notices almost nothing: the nearest copy is roughly where the server always was. Switching one on rarely means rebuilding the site; it is usually a change to the domain’s DNS records, or a separate address for static files.

Why it matters for a business

Hosting companies sell a CDN as an add-on, and services such as Cloudflare sell one as a standalone product, so the decision usually lands with the owner. What you buy: faster files for distant visitors, less load on the server during a campaign or a sale and, with many providers, protection against DDoS attacks. What you do not buy: a fast server. If a page takes two seconds to assemble in the database, copies of the photos in Frankfurt will not change that, and they will not lighten a heavy theme or a page crowded with scripts either.

That is why our website speed optimisation work starts by measuring where the delay comes from, and only then says whether a CDN is worth it.

What to ask

  • What share of our visitors is far from the server? The country report in our analytics has the answer.
  • Which files will go through the CDN: images, stylesheets and scripts only, or the pages as well?
  • Are the basket, the checkout and customer accounts kept out of the cache?
  • How is the cache cleared when we replace a photo or a file?
  • Whose name is the CDN account in, and who controls the domain’s DNS records?
  • Is there a data processing agreement with the provider? It sees every visitor’s IP address.

A term you do not recognise? Write to us and we will add it.

The glossary grows with the questions we are asked.