CDN Content Distribution & Caching 4 — Questions and Answers
Question 1: When a CDN performs 'cache key normalization', what is the main benefit?
- Encrypting cache keys for security
- Increasing cache hit rates by stripping irrelevant query parameters from the cache key (Correct answer)
- Compressing cache metadata to save memory
- Sorting cache entries alphabetically for faster lookup
Correct answer: Increasing cache hit rates by stripping irrelevant query parameters from the cache key
Normalizing cache keys (e.g., removing tracking parameters like 'utm_source') prevents duplicate cache entries for functionally identical URLs.
Question 2: Which HTTP response code from origin tells a CDN to serve the cached version of a resource (if available) because origin is temporarily unavailable?
- 502 Bad Gateway
- 503 Service Unavailable
- 504 Gateway Timeout
- All of these may trigger stale-if-error serving (Correct answer)
Correct answer: All of these may trigger stale-if-error serving
The 'stale-if-error' directive allows CDNs to serve stale cache on any 5xx or network error from origin.
Question 3: What is 'Surrogate-Control' header primarily used for in CDN caching?
- Controlling browser cache behavior separately from CDN behavior
- Passing CDN-specific cache directives that CDNs honor but browsers ignore (Correct answer)
- Authenticating requests between CDN and origin
- Setting CORS policies at the CDN layer
Correct answer: Passing CDN-specific cache directives that CDNs honor but browsers ignore
Surrogate-Control lets origin set CDN TTLs independently from browser TTLs since CDNs consume and strip this header before forwarding.
Question 4: A news website uses URL-based cache invalidation but realizes it cannot purge all edge nodes fast enough during breaking news. What pattern best addresses this?
- Increase TTL to avoid frequent purges
- Use versioned URLs with short TTLs so updates deploy new URLs instantly (Correct answer)
- Switch to cookie-based routing
- Disable caching for the news section entirely
Correct answer: Use versioned URLs with short TTLs so updates deploy new URLs instantly
Versioned URLs (cache-busting) guarantee fresh content without relying on purge propagation speed, as new URLs start with empty caches.
Question 5: Which caching layer sits closest to the end user in a typical multi-tier CDN architecture?
- Origin server
- Regional PoP (parent cache)
- Edge PoP (leaf node) (Correct answer)
- DNS resolver cache
Correct answer: Edge PoP (leaf node)
Edge PoPs (leaf nodes) are geographically distributed closest to users and handle the initial request before escalating to parent caches.
Question 6: What does a 'MISS, stored' X-Cache response header from a CDN edge node indicate?
- The resource was not found in cache and will not be cached
- The resource was not in cache, fetched from origin, and is now cached for future requests (Correct answer)
- The cached resource was found but was invalid
- The resource was fetched but storage is full
Correct answer: The resource was not in cache, fetched from origin, and is now cached for future requests
'MISS, stored' confirms a cache miss occurred but the response was successfully stored at the edge for subsequent cache hits.
Question 7: Which technique allows a CDN to serve personalized content while still leveraging edge caching for the page shell?
- Full-page dynamic rendering at origin
- Fragment caching — cache the static shell, personalize only via client-side JavaScript or ESI fragments (Correct answer)
- Disabling caching for authenticated users
- Using cookies as the only cache key variant
Correct answer: Fragment caching — cache the static shell, personalize only via client-side JavaScript or ESI fragments
Fragment caching separates the cacheable page shell from personalized components fetched client-side or assembled via ESI at the edge.
When a CDN performs 'cache key normalization', what is the main benefit?