Interview's MateSystem Design
Interview's Mate

System Design

Architecture & trade-offs

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
All topics/CDN & Edge Computing
FUNDAMENTALS & NETWORKING · SUBTOPIC

Edge Computing & Cache-Control

Run lightweight logic near users and control freshness with HTTP caching headers.

IntermediatePart of CDN & Edge Computing
Practice in AI HLD
Subtopics in CDN & Edge Computing (2)
OverviewPush vs. Pull CDNEdge & Headers

In plain words

Edge computing lets small snippets of your code run right inside the nearby CDN tower - checking logins, redirecting users, or A/B testing without a trip to your main data center.

Think of it like…

Ticket checkers at the stadium gate (the edge) turning away invalid tickets before anyone enters the building.

Loading interactive diagram
Loading interactive exercise

Theory & how it works

Essential Cache-Control directives

public, max-age=3600 allows CDNs and browsers to cache for 1 hour. private allows the user’s browser to cache, but forbids shared CDNs from caching sensitive personal data.

stale-while-revalidate=60 is a superpower: serve the slightly stale cached copy immediately (0 ms wait!) while silently refreshing it in the background.

Key points & practical guide

Summary checklist

  • Never cache private user responses on shared CDN edges
  • Use stale-while-revalidate for fast feeds and product pages
  • Run JWT verification, geo-routing, and bot protection at the edge

When to use it

  • Global latency optimization
  • Auth token checks and A/B testing at the network edge

Watch out for

  • Putting heavy database queries inside edge workers (they usually don’t have a nearby primary DB)

Quick check

Loading quiz
Previous subtopic
Push vs. Pull CDNs & Origin Shield
Back to overview
Full CDN & Edge Computing Lesson