We run a content site with images and articles, and read traffic is mostly global. How would you use a CDN and edge caching to cut latency and origin load, and what content can't be cached that way?

system-design · Mid level · software-engineering

What the interviewer is really asking

Assesses understanding of CDN/edge caching specifically — cache-control semantics, static vs dynamic/personalized content, and edge invalidation — distinct from an application-tier key-value cache like Redis.

What to say

What to avoid

Example answers

Strong: Reads are global, so I'd put a CDN at the edge for everything cacheable: images, JS/CSS, and stable article pages, served from POPs near each user. I'd drive it with Cache-Control — immutable hashed asset URLs get a year-long max-age, article HTML gets a shorter TTL with stale-while-revalidate so a refresh is invisible to users. Content-hashed filenames mean a deploy publishes new URLs, so I rarely need to purge. What I won't edge-cache is anything personalized or authenticated — the logged-in header, recommendations, account pages — those skip the shared cache. I'd split the page so the cacheable shell is at the edge and the personalized bits hydrate from the origin.

Weak: I'd put a CDN in front of the whole site and cache every response so everything is fast everywhere.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.