Bookmarks

CDN — content delivery network

A distributed network of servers that stores copies of a site’s files and serves them to the user from the nearest node rather than from the main server.

Also: content distribution network, content delivery network, CDN

checked 9 Nov

All terms

A CDN takes over serving static files such as images, video, styles and scripts: instead of a single server, the nearest node in the network answers the user. This speeds up the site and removes most requests and traffic from the main server.

How it works

ElementRole
Originthe site’s main server, which the CDN contacts for files
Edgea CDN server in the user’s city or country; holds copies of popular files
TTLhow long a copy lives on the edge; set by the origin with a header such as Cache-Control: max-age=600

This usually works on a pull model: on the first request, the edge fetches the file from the origin, serves it to the user and keeps it until the TTL expires. To refresh a file earlier, you use invalidation, a separate operation in the CDN control panel.

  • Static content is the CDN’s main job: images, video, styles, scripts, fonts.
  • Personalised responses are not cached by default: if cookies end up in the cache key, each user gets their own copy of the object.

What it gives you

  • Speed: the response comes from an edge in the user’s own region rather than from a server on another continent.
  • Origin offload: most requests never reach the main server, so it can be smaller and cheaper.
  • Resilience: a DDoS attack hits a distributed network of nodes rather than a single server, and is filtered along the way.
  • Connections: the nearest node handles the TLS handshake and HTTP/2 and HTTP/3 requests, while data travels to the origin over the CDN’s network.

Users are directed to the “nearest” node by DNS: for example, Amazon CloudFront picks the node that can serve the request best, usually the one with the lowest latency. Other networks use anycast: one address is announced from many points in the network, and routing itself brings the user to the closest node.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • reverse proxy

    A reverse proxy sits in front of a single server of your own; a CDN applies the same principle with a network of nodes in different countries.

  • load balancer

    A load balancer splits load among servers in one cluster; a CDN splits it among nodes in different regions.

In depth in the references

where the topic is covered in detail