Try
↑ ↓ move↵ openesc close

Interview prep / CDNs and edge caching

Mid · CDNs and edge caching · System design interview question

How do you keep content fresh at the edge: a short TTL, a purge, or versioned file names?

Sketch your own answer first, then compare it with the one below.

A strong answer

A short TTL is the simplest. It bounds staleness and sends more traffic to the origin all the time.

A purge deletes copies when the content changes. You keep a long TTL and still get fresh content. The cost is an extra system that must reach every cache, and a purge that misses one edge leaves an old copy there until its TTL ends. Keep a TTL as a safety net.

Versioned names put a hash in the file name. A new version is a new key, so the old copy can be cached for a very long time and never needs a purge. It fits files that pages reference. It does not fit the page itself, which needs a fixed address.

Sources

Learn it by running it

The cdns and edge caching lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms