CachingCDN CachingMedium⏱️ ~2 min

Push vs Pull CDN Caching Strategies

Pull Caching (On Demand)

Reactive caching: first user request triggers cache miss, CDN fetches from origin, caches response, serves it. Subsequent requests in that region are hits until expiry or eviction. Pull is default for most web content because it requires no advance planning, automatically adapts to actual demand, and conserves storage by only caching what users request. The downside is cold start latency: first request per region suffers full round trip to origin, adding 100-300ms compared to an edge served request at 20-50ms. For long tail content with sporadic access, pull is efficient because rarely accessed items do not consume storage.

Push Caching (Pre positioning)

Proactive caching: upload content to edges before users request it. Eliminates cold starts entirely, achieving sub 50ms TTFB (Time To First Byte) globally from the very first request. Requires storage capacity planning and lifecycle management because content must be uploaded to each region, consuming storage even if rarely accessed. Best for large media libraries with predictable demand (video streaming, software downloads) where cold start latency directly impacts user experience and first impressions.

Hybrid Strategies

Most production systems combine both: push for known high demand content (new video releases, major software updates), pull for long tail content where demand is unpredictable. Pre warm during low traffic periods by fetching content into caches before demand spikes. Schedule warming jobs to run hours before expected traffic peaks (game launches, live events, marketing campaigns). Monitor cold start rates and warm specific content paths based on historical patterns and predicted demand signals.

Decision Framework

Pull: unpredictable demand, long tail content, storage cost sensitive workloads. Push: predictable high demand, latency critical first byte, large media catalogs where first user experience matters. Hybrid: scheduled events, product launches, live streaming. The cost trade off is storage vs latency: push consumes 10-100x more storage but delivers consistent sub 50ms latency.

💡 Key Takeaways
Pull (on demand): first request triggers fetch, 100-300ms cold start. No planning needed, conserves storage for long tail.
Push (pre positioning): uploads before requests, sub 50ms TTFB globally. Requires storage planning, best for high demand content.
Hybrid: push for known demand, pull for long tail. Pre warm caches hours before expected traffic spikes.
Trade off: pull conserves storage (10-100x less) but has cold starts; push eliminates cold starts at storage cost.
📌 Interview Tips
1Cold start: first user in eu-west requests video, 200ms round trip to origin. Second user gets 30ms edge hit.
2Pre warming: schedule warming jobs 2 hours before game launch, fetch popular assets into all regions.
3Hybrid: push new movie release to all 200 PoPs, pull 10-year-old catalog items on demand.
← Back to CDN Caching Overview