# Push CDNs: You Upload Your Content Before Users Ask for It

> How a Push CDN keeps your files on edge servers ahead of time, what you must manage yourself, and when it beats a Pull CDN.

**In short:** A Push CDN is a content delivery network where you upload your files to its edge servers yourself, before any user asks for them.

From "System design", a free course by Venkat R. Murty: https://designervenkat.online/learn/system-design/push-cdns

## What you will learn

A Push CDN is a content delivery network where you do the uploading yourself. A content delivery network, or CDN, is a group of servers spread across many places. It keeps copies of your files near the people who download them. In a Push CDN, you send your files to those servers before anyone asks for them. This lesson explains how that works, when it is a good choice, and how it differs from the other common style, the Pull CDN. By the end, you should be able to say who moves the content, when it moves, and what you must look after once it is uploaded.

- **Content delivery network (CDN):** A group of servers in many places that stores copies of your files and sends them to users from a nearby spot.
- **Origin server:** The main machine where the master copy of your files lives. It is the source the copies come from.
- **Edge server:** A CDN server close to users. It holds copies of your files and answers their download requests.
- **Push:** Sending a file from your side to another place, on your own schedule, before anyone needs it.
- **Pull:** Letting another place fetch a file from you when that place first needs it.
- **Expire:** Marking a stored copy as no longer valid, so the CDN stops serving it.
- **URL:** The web address of a file, such as the link a button or page uses to download it.
- **URL rewriting:** Changing the addresses in your pages so they point to the CDN copy instead of your own server.

## How Does a Push CDN Work?

In a Push CDN, the content owner controls what sits on the edge. The origin server still keeps the master copy. When a file is new or has changed, the owner sends it to the CDN. The CDN then spreads that file to its edge servers. This happens before any user asks for the file. So when a user later makes a request, a nearby edge server already has the file and can answer at once.

1. **Create or change the file:** You make a new file or change an old one on your side, such as a new version of a document or an app installer.
2. **Upload it to the CDN:** You send the file to the CDN's storage. Providers usually offer a web console, an API, or a command-line tool for this step.
3. **The CDN spreads the copies:** The CDN places the file across its network so that edge servers in each region hold a copy before users arrive.
4. **A user asks for the file:** A nearby user requests the file, and an edge server answers from the copy it already has.
5. **You update or expire the old copy:** When the file changes again, you upload the new version and replace the old one, or you tell the CDN to expire the old copy.

Notice that the owner makes each decision. The CDN does not guess when a file is new. It waits for you to upload it, and it keeps serving what you last sent until you change or remove it.

> **Tip:** Put a version number in each file name, such as patch-2.1.zip. A new version then gets a new address, and old and new copies cannot get mixed up on the edge.

### What Must the Owner Manage?

- **Uploads:** Every new or changed file must be sent to the CDN by a person or a script. If nobody uploads it, users get old content or nothing at all.
- **URL rewriting:** Your pages must link to the CDN address. A page that still points to your origin server gets no benefit from the CDN.
- **Updates and expiry:** You decide when old copies are replaced or removed. The CDN will not make that call for you.

## What Are the Trade-offs of a Push CDN?

A Push CDN is not better or worse in every case. It trades effort for control. You do more work, and in return you know exactly what is stored and when it changes. The list below shows the main gains and costs.

- **Good fit:** Large static files that rarely change. Examples include software installers, game patches, and large files released on a set day.
- **Light load on the origin:** Files travel to the CDN only when they are new or changed. Your origin server does not carry every download, so it uses less traffic.
- **Extra work for you:** You must run the uploads, rewrite the links, and manage updates. This is ongoing work, not a one-time setup.
- **Possible wasted storage:** If you upload a file and nobody ever asks for it, the copy still sits on the CDN and you may still pay for the space.

### When Does the Trade-off Tip?

The balance depends on two things: how often content changes, and how much of it people actually request. A site with a few large, stable files and known release days gets the most value. A site with many small files and unpredictable requests may spend more effort uploading than the uploads are worth.

> **Tip:** Before you choose, ask two questions. How often does this file change? Will people download it soon after it is published?

**Quick check:** A photo-sharing site has millions of user photos. Most photos are viewed by only a few people, and many are never viewed at all. Which CDN style fits better?

A. A Push CDN, with every new photo uploaded by hand as soon as it is posted
B. A Pull CDN, so that a photo is copied to the edge only when someone first asks for it
C. A Push CDN, uploaded once a year in one large batch
D. No CDN at all, because the origin can serve every photo directly

**Answer:** B. Pushing millions of rarely viewed photos would waste storage and create a lot of upload work. A Pull CDN copies only what people actually request, so it fits this long tail of files.

## Worked example: a game patch

A small indie game studio is about to release a 2 GB patch. A GB, or gigabyte, is a unit of file size, so this file is large. Launch day is fixed, and the studio expects thousands of players to click Download at almost the same moment. A Push CDN suits this case. The file is large, it is known well ahead of time, and it will not change once it is released. Here is how the studio would handle it.

1. **Finish the patch early:** The studio builds the final 2 GB file and checks it. The file is ready days before players can see the download button.
2. **Upload it before launch:** On the CDN's console, the studio opens the Files page of its Push Zone, chooses the patch, types a file name, and clicks the upload button.
3. **Let the CDN spread it:** The CDN copies the file to its edge servers. When the upload is finished, each edge location already holds the file.
4. **Point the button at the CDN:** The studio changes the download link so it points to the CDN address for this file, not to the studio's own server.
5. **Replace or expire it later:** When a newer patch comes out, the studio uploads the new file and removes or expires the old one.

On launch day, thousands of downloads start together. Each player is answered by a nearby edge server that already has the file. No edge server has to wait for the studio's origin server to send the first copy of 2 GB.

### Check the link before launch

> **Tip:** Test the new download link from a network far from your office before launch day. This shows you that the CDN address works and that the file opens correctly.

## How Do a Push CDN and a Pull CDN Compare?

The key difference is who moves the content and when. With a Pull CDN, the CDN fetches a file from your origin the first time someone asks for it in a region, and then keeps a copy. With a Push CDN, you move the file first, so the copy is already waiting. Both styles aim to serve users from a nearby edge server.

- **When content arrives:** Push: before any user asks, when you upload it. Pull: at the first request that reaches each edge server.
- **Who manages the copies:** Push: you do, through uploads and expiry. Pull: the CDN handles most of this automatically.
- **The first request in a region:** Push: the file is usually already stored, so the first user does not wait for an origin fetch. Pull: the first user in a region may wait longer.
- **Best fit:** Push: large, planned files that change rarely. Pull: general web content, and content that changes often or comes in very large numbers.

### Choosing between them

Pick based on how often content changes and how much traffic it gets. Frequent changes and spread-out traffic point toward Pull. Rare changes and sharp traffic spikes after a known release point toward Push. Many sites use both: Push for a few big, known files, and Pull for everything else.

**Quick check:** A documentation site publishes a new version of its PDF manual only twice a year. Traffic spikes right after each release. Which CDN style fits better, and what must the team do on release day?

A. A Pull CDN, and nothing on release day, because the first reader will fetch the new file automatically
B. A Push CDN, uploading the new PDF before the release, updating the links to it, and expiring the old copy
C. A Push CDN, and leaving the old manual online with no upload, so readers can choose either version
D. A Pull CDN, and deleting the cached copy on every edge server by hand each time a reader asks

**Answer:** B. The manual changes rarely and the traffic arrives in a spike, so pushing it before release avoids a slow first fetch. On release day the team must upload the file, rewrite the links, and expire the old copy.

## A small model in code

The Python sample below models the idea in a few lines. Each edge server keeps a set of file names. A push copies a file to every edge before anyone asks. A request is answered from the edge only if that file is already stored there. The sample uses only the standard library, so it prints the same result every time.

```python
edges = ['london', 'tokyo', 'new-york']
stored = {place: set() for place in edges}

def push(filename):
    for place in edges:
        stored[place].add(filename)
    print(f'pushed {filename} to {len(edges)} edge servers')

def request(place, filename):
    if filename in stored[place]:
        print(f'{place}: served {filename} from the edge')
    else:
        print(f'{place}: {filename} is not stored here')

push('patch-1.0.zip')
request('tokyo', 'patch-1.0.zip')
request('tokyo', 'patch-0.9.zip')

```

Output:

```text
pushed patch-1.0.zip to 3 edge servers
tokyo: served patch-1.0.zip from the edge
tokyo: patch-0.9.zip is not stored here

```

Read the output as a story. The push happened first, so the Tokyo edge could answer for the new patch right away. The old patch was never pushed, so the same edge has nothing to give for it. A real CDN does much more than this, but the core rule is the same: what you pushed is what the edge can serve.

## Summary

A Push CDN lets you place your files on edge servers before users ask for them. You decide what is stored, when it changes, and when it expires. That control gives you ready content on launch day and less load on your origin, but it also means uploads, link changes, and clean-up are your job. Choose it for large, known, rarely changing files, and choose a Pull CDN when content changes often or is spread across many files that few people request.

## Sources

- [GeeksforGeeks: Pull CDN vs. Push CDN (System Design)](https://www.geeksforgeeks.org/system-design/pull-cdn-vs-push-cdn/)
- [DesignGurus: Push CDN vs. Pull CDN (Grokking System Design Fundamentals)](https://www.designgurus.io/course-play/grokking-system-design-fundamentals/doc/push-cdn-vs-pull-cdn)
- [DevWithTools: CDN Explained, How Content Delivery Networks Work](https://devwithtools.org/blog/cdn-explained)
- [YeetCode: How a CDN Works, Edge Caching, Routing and Trade-offs](https://www.yeetcode.in/blogs/system-design/cdn)
- [Layrs: Push CDNs, When to Pre-populate Edge Caches](https://layrs.me/course/hld/03-networking-dns/push-cdns/)
- [AlgoMaster: Content Delivery Network (CDN)](https://algomaster.io/learn/system-design/content-delivery-network-cdn)
- [CalibreOS: CDN, Edge Caching, Push vs Pull, and Invalidation at Global Scale](https://www.calibreos.com/learn/hld-cdn)
- [FlashEdge CDN: Push CDN vs. Pull CDN, What's the Difference?](https://www.flashedgecdn.com/blog/push-cdn-pull-cdn/)
- [Vultr Docs: Upload Files to a Vultr CDN Push Zone Subscription](https://docs.vultr.com/products/network/cdn-push-zone/management/files)
- [Vultr Docs: Vultr Content Delivery Network (Push Zones)](https://docs.vultr.com/vultr-content-delivery-network)
- [PUSHR Knowledge Base: How to use push (storage) CDN zones](https://pushr.io/knowledgebase/how-to-use-push-storage-cdn-zones/)
