Skip to content
RED SAGSkills
easyCloud Engineer interview question

How does a CDN work, and what should you consider when caching content with one?

What the interviewer wants to hear

  • Edge locations cache copies of content close to users
  • Cache hit serves from edge; miss goes to the origin
  • TTLs and Cache-Control headers decide how long content stays
  • Cache key design and invalidation or versioned file names
  • Do not cache private or user-specific responses by mistake

Model answer

A CDN has many edge locations around the world. When a user requests a file, DNS sends them to a nearby edge. If the edge has a cached copy, it returns it at once, which is a cache hit; if not, it fetches from the origin, such as an S3 bucket or load balancer, stores it and returns it. This lowers latency and takes load off the origin. The main things I think about are TTLs and Cache-Control headers, which decide how long content is kept, and the cache key, because including unnecessary headers or cookies kills the hit ratio. For updates I prefer versioned file names like app.3f2a.js over frequent invalidations. Finally, I make sure personalized or private responses are marked no-store or private so the CDN never serves one user data to another.

Can you answer it under time pressure?

Take a timed easy round and get scored on every answer.

Start mock interview

More easy Cloud Engineer questions