Skip to content

CDN: Push vs. Pull Zones

One-Liner

The two primary methods for getting content into a CDN: proactively uploading it (push) or having the CDN fetch it on demand (pull).

What It Is

  • Pull Zone: The CDN “pulls” content from your origin server when a user requests it for the first time. The content is then cached at the edge for subsequent requests.
  • Push Zone: You “push” (upload) your content directly to the CDN’s storage. Users then access the content from the CDN directly.

Why It Exists

To provide different strategies for different types of content and traffic patterns.

How It Works

  • Pull: The CDN acts as a reverse proxy, fetching content from a specified origin server upon the first request to a given edge location.
  • Push: The developer uses an API or tool to upload files to a dedicated storage space provided by the CDN.

Tradeoffs

Pull Zone

  • Pros: Simple to set up, only caches content that is actually requested.
  • Cons: The first request for an asset is slow (cache miss), can put significant load on the origin server if the cache is frequently missed.

Push Zone

  • Pros: All content is fast from the first request, reduces load on the origin server.
  • Cons: More complex to manage, can result in storing content on the CDN that is never requested.

Failure Modes

  • Pull Zone: A downed origin server can prevent new content from being pulled into the CDN.
  • Push Zone: Forgetting to push updated assets leads to stale content being served.

Interview Traps

  • Not being able to explain which strategy is better for a given use case (e.g., pull for a website’s static assets, push for large files like video or software downloads).

Real-World Usage

  • Pull: Most websites use a pull CDN for their CSS, JS, and image files.
  • Push: Video streaming services, software distribution.

Anti-Patterns

  • Using a pull zone for very large files that are infrequently accessed.
  • Using a push zone for a rapidly changing website where assets are constantly being updated.
  • CDN Cache Busting
  • Time-to-Live (TTL)