system-design-primer
reference — getting there

Content delivery network

in short — written for this site
A globally distributed network of proxy servers, serving content from locations closer to the user.
push CDN
You upload content when it changes and rewrite URLs to point at the CDN. Content is stored until you replace or expire it. Best for small traffic or content that is not often updated.
pull CDN
Grabs new content from your server on the first user request. You leave the content on your server and rewrite URLs. The first request is slower until the content is cached; TTLs determine how long it lives.
cost
CDN costs can be significant depending on traffic — although weigh that against not using one. Content might be stale if it is updated before a TTL expires. Assets need URL rewriting to point at the CDN.
from the primer — full sectionsynced
Source: Why use a CDN
Source: Why use a CDN

A content delivery network (CDN) is a globally distributed network of proxy servers, serving content from locations closer to the user. Generally, static files such as HTML/CSS/JS, photos, and videos are served from CDN, although some CDNs such as Amazon's CloudFront support dynamic content. The site's DNS resolution will tell clients which server to contact.

Serving content from CDNs can significantly improve performance in two ways:

  • Users receive content from data centers close to them
  • Your servers do not have to serve requests that the CDN fulfills

Push CDNs

Push CDNs receive new content whenever changes occur on your server. You take full responsibility for providing content, uploading directly to the CDN and rewriting URLs to point to the CDN. You can configure when content expires and when it is updated. Content is uploaded only when it is new or changed, minimizing traffic, but maximizing storage.

Sites with a small amount of traffic or sites with content that isn't often updated work well with push CDNs. Content is placed on the CDNs once, instead of being re-pulled at regular intervals.

Pull CDNs

Pull CDNs grab new content from your server when the first user requests the content. You leave the content on your server and rewrite URLs to point to the CDN. This results in a slower request until the content is cached on the CDN.

A time-to-live (TTL) determines how long content is cached. Pull CDNs minimize storage space on the CDN, but can create redundant traffic if files expire and are pulled before they have actually changed.

Sites with heavy traffic work well with pull CDNs, as traffic is spread out more evenly with only recently-requested content remaining on the CDN.

Disadvantage(s): CDN

  • CDN costs could be significant depending on traffic, although this should be weighed with additional costs you would incur not using a CDN.
  • Content might be stale if it is updated before the TTL expires it.
  • CDNs require changing URLs for static content to point to the CDN.

Source(s) and further reading

sourcedonnemartin/system-design-primer / README.mdanchor#content-delivery-networksyncedsynced from donnemartin/system-design-primer@master · 2026-08-16