Ch. 19 · System Design

System Design CDNs and Cacheable Content

System Design CDNs and Cacheable Content. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readbeginnerupdated Oct 3, 2026

CDNs reduce origin work and delivery distance for cacheable responses. Cache keys and privacy rules determine whether sharing is correct.

Before you start

You should understand API requests, storage and basic capacity estimates. Begin with a concrete user action and its correctness requirement. Draw data flow and failure boundaries before selecting infrastructure; a technology name by itself does not explain why a design meets the requirement.

The practical goal is to reason through this situation: Versioned static assets can be cached broadly; personalized account responses need a different policy. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.

Step-by-step walkthrough

Step 1: Classify shareable responses

Static assets and personalized account content need different cache policy.

Step 2: Design the cache key

Include every dimension required to prevent incorrect cross-user sharing.

Step 3: Plan coherent updates

Version asset URLs and control HTML freshness or invalidation.

Worked scenario

Versioned static assets can be cached broadly; personalized account responses need a different policy.

A content-hashed JavaScript URL can stay cached because changed bytes get a new name. Personalized HTML must not enter a public cache without the necessary isolation. Deploying new HTML that references already available versioned assets avoids inconsistent combinations while retaining useful long-lived asset caching.

Common mistake

Caching a response without user separation can expose private content.

Verify the behavior

Test asset changes and two users’ private responses through the actual cache.

Interview exercise

Design asset updates.

Answer and reasoning

Use content-versioned URLs and explicit cache policy, retaining a coherent deployment and invalidation strategy for HTML.

Continue learning

Compare the scenario with the System Design interview questions and test your understanding with the System Design MCQs. For terminology and implementation details, consult the reference material.

More in System Design

read ✓System Design · hard

System Design: Bloom Filters

Use a Bloom filter to skip lookups with a tiny memory footprint, and understand its false-positive-only guarantee.

~2 min readread →
read ✓System Design · hard

System Design: Idempotent APIs

Make retried requests safe with idempotency keys, store the result per key, and return the original response on a repeat.

~2 min readread →
esc