An edge near the user — hit and miss — per-region caching that cuts origin RPS
An edge caches origin's response so the FIRST request in a region pays the full RTT but every later request in that region is served locally in milliseconds — and origin only hears about misses.
One origin can't be close to everyone — so we put a copy of the content near each user, and now the question is whether having a copy nearby is enough to make every request fast.
Scene 02
An edge near the user — hit and miss
- Watch
- Try it
- Predict
- Capture
Each region's first request goes all the way to origin (long orange arrow) and the local cache slot fills green. Subsequent requests in the same region come back fast from the edge — the latency strip drops from ~200 ms to ~10 ms.
Highlighted lines are the ones running in the diagram right now.
def handle(req):key = cacheKey(req) # URL + Vary axesentry = self.cache.lookup(key)if entry is not None:return entry.body # HIT — served locally# MISS — origin is the only sourcebody = origin.fetch(req.url)self.cache.store(key, body)return body
def lookup(key):# self.slots lives in THIS POP's RAM/SSD only.# Sibling edges in other regions are never queried.entry = self.slots.get(key)if entry is None:return None # caller must go to originreturn entrydef store(key, body):self.slots[key] = Entry(body)
Where this sits in Build a CDN
Scene 02 of 13, in the Edge basics act — The request journey, origin pain, an edge near each user, POPs and anycast.. An edge cache absorbs the second request in each region; the first still pays the full RTT, and edges don't share content across regions.
Up next. Edges only help if users actually land on a nearby one — so how does a user in Sydney find Sydney's edge in the first place?