Course contentsShow
← System Design
Lesson 1614 of 1,91939. Real-World System: Image and Video HostingFree lesson

Origin Shield Pattern

Using a single intermediate cache layer to collapse requests and minimize origin load.

Origin Shield Pattern

What you'll learn: How to insert a single intermediate cache layer that sits between your CDN edge nodes and your origin servers to dramatically reduce origin load.

The Core Idea

When you have a global CDN with hundreds or thousands of edge locations, each edge can independently request the same content from your origin servers if it's not cached locally. This creates a cache stampede at the origin — especially for popular videos or images.

The Origin Shield is a dedicated caching layer positioned between your CDN edges and origin storage. Instead of every edge node requesting content directly from origin (say, S3 or your object storage), they all route through one or a few regional shield locations.

How It Works

Think of it like a warehouse distribution center:

  • Without Origin Shield: 500 retail stores (edge nodes) each call the factory (origin) directly for the same product → 500 requests hit the factory
  • With Origin Shield: All 500 stores call one regional warehouse (shield), which calls the factory once → 1 request hits the factory, warehouse serves the 500 stores

Request Flow

User → CDN Edge (miss) → Origin Shield (checks cache)
                            ├─ Hit: serves from shield cache
                            └─ Miss: fetches from origin once

Multiple edge nodes requesting the same file almost simultaneously get collapsed into a single request to origin. The shield caches the response and serves all waiting edges.

Benefits

  • Reduces origin load by 80-95% for popular content
  • Lowers origin bandwidth costs significantly
  • Protects origin during traffic spikes or viral content
  • Improves cache hit ratio through consolidation

Key Takeaway: Origin Shield acts as a centralized cache buffer between CDN edges and origin, collapsing redundant requests and preventing origin overload when content goes viral.