Content delivery networks (CDNs)

Serve content from edge locations closer to users and reduce origin load.

In this article

A content delivery network (CDN) is a globally distributed network of proxy servers. It serves content from an edge location near the user. Static HTML, CSS, JavaScript, images, and video are common CDN content. Some CDNs also cache dynamic responses.

Fig 1Keep content closer to its readers
STUDY MODEL
Inspect one part at a timeOrigin
  1. Origin

    The origin holds source content.

  2. Nearby edge

    The user requests content from an edge chosen by the delivery network.

  3. Hit

    A usable cached response is served without contacting origin for that response.

  4. Miss

    The edge fetches from origin and applies the configured caching policy.

A hit can return the edge copy. A miss must obtain content from the origin.

How to read this model

An origin archive beside a nearby edge retrieval drawer. The object is a teaching analogy. Inspecting a part highlights its role; it does not execute or simulate the software. Cabinet trays are records, workpieces are data, and latches are checks. Unless an explanation states a quantity, compartments and sample workpieces do not denote data counts. Part dimensions are not a quantitative scale.

Concept redrawn from Why use a CDN.

Fig 2Push prepares the edge; pull waits for demand
STUDY MODEL
Inspect one part at a timePush
  1. Push

    Upload or distribute content to the edge before a user requests it.

  2. Pull miss

    The first uncached request causes the edge to fetch from origin.

  3. Later hit

    Subsequent requests can use the stored edge response while it remains usable.

Both strategies need cache lifetime and invalidation rules.

How to read this model

An upload feeder beside a demand-triggered retrieval drawer. The object is a teaching analogy. Inspecting a part highlights its role; it does not execute or simulate the software. Cabinet trays are records, workpieces are data, and latches are checks. Unless an explanation states a quantity, compartments and sample workpieces do not denote data counts. Part dimensions are not a quantitative scale.

CDNs improve performance in two ways. The user travels a shorter network distance to an edge. The origin does not handle requests satisfied by the edge. DNS normally directs the client to the appropriate CDN location.

Push CDNs

A push CDN receives content when your origin changes it. Your deployment uploads the file, chooses its expiry, and points clients at the CDN URL. Push delivery avoids the first-user cache miss and uploads only new or changed files. It uses more CDN storage and requires the origin or deployment process to manage uploads.

Push delivery fits smaller sites and content that changes infrequently. A release can publish a versioned filename, such as app.8f3c.js, so old and new content do not share a cache key.

Pull CDNs

A pull CDN fetches content from the origin when the first user requests it. The edge stores the response until its TTL expires. The first request is slower, but the CDN stores only content users request.

Pull delivery fits high-traffic sites with a large set of content. Expiry can cause repeated origin fetches even when a file did not change. Cache-control headers and explicit invalidation control that trade-off.

Strategy First request Storage Origin work Good fit
Push Fast because content is preloaded Higher Publish-time upload Smaller, stable content sets
Pull Slower on a miss Lower First request after expiry Large, frequently requested content

Costs and failure modes

CDN traffic costs money, so compare the fee with the origin bandwidth and compute it replaces. A cached response can be stale until its TTL ends. Changing application URLs, cache headers, and invalidation rules adds deployment work. Do not cache personalized or private responses under a shared key.

See DNS for routing to an edge and caching for cache update strategies.

Further reading

Keep track of your reading.

Your reading progress stays in this browser.