categories.performance Intermediate

CDN Strategy and Static Asset Optimization

AI Practice

Explain how CDNs work and how to use them effectively.

What Is a CDN

A Content Delivery Network distributes static assets to edge servers worldwide, so users fetch resources from the nearest node, reducing latency.

How It Works

  1. User requests a resource.
  2. DNS resolves to the nearest CDN edge server.
  3. Edge server returns cached response (Cache Hit) if available.
  4. Otherwise, pulls from origin (Origin Pull) and caches the result.

Cache Control

  • Static assets (hashed JS/CSS): Set long TTL (e.g., 1 year); rely on URL changes for invalidation.
  • Dynamic content (HTML): Set short TTL or no-cache.

CDN Offload Strategy

  • Static assets (images, JS, CSS, fonts): Route all through CDN.
  • API responses: Use Stale-While-Revalidate for some.
  • User-generated content: Upload directly to CDN origin (e.g., S3) to bypass the app server.

✦ AI Mock Interview

Type your answer and get instant AI feedback

Sign in to use AI scoring

Copyright © 2026 Wood All Rights Reserved · FE Interview Hub