Back to the Catalog
system-design
http
performance

Caching at Every Layer

30 questions

Follow one request from the browser outward through every cache it can hit — the HTTP cache (Cache-Control, ETag, Last-Modified, revalidation), the CDN edge, the client query cache (React Query / SWR), and server-side memoization — then face the hard part: invalidation. Covers strong vs. weak validators, stale-while-revalidate, cache stampedes and request coalescing, negative caching, and cache keys. Every explanation proves its answer against the relevant RFC.

Questions

  1. Not answered. Who coined the "two hard things in Computer Science" quip?
  2. Not answered. What does Cache-Control: no-cache actually permit?
  3. Not answered. When does no-store belong on a response?
  4. Not answered. What does Cache-Control: private tell caches?
  5. Not answered. Why is the CDN serving one user's data to everyone, and what's the fix?
  6. Not answered. How long does each cache treat this response as fresh?
  7. Not answered. Which numeric HTTP status lets the cache reuse its copy without re-sending the body?
  8. Not answered. Which constraint does a correct 304 Not Modified response obey?
  9. Not answered. When a cache revalidates a stored GET response, which header pairing does it use?
  10. Not answered. What does the W/ prefix on an ETag signify?
  11. Not answered. Why must a range request's validator be a strong ETag, not a weak one?
  12. Not answered. Why can Last-Modified (without an ETag) serve a stale body even though revalidation "succeeded"?
  13. Not answered. Which directive lets a cache return a stale response immediately while it revalidates in the background?
  14. Not answered. What does the user experience 700 seconds after the response was stored?
  15. Not answered. Which directive lets a cache keep serving a stale copy when revalidation fails (origin error or unreachable)?
  16. Not answered. What is the practical effect of adding must-revalidate to max-age=60?
  17. Not answered. What does immutable add over the year-long max-age alone?
  18. Not answered. For how many hours will a cache treat this response as fresh?
  19. Not answered. What does Vary: Accept-Encoding instruct caches to do?
  20. Not answered. What's the likely consequence of adding Vary: User-Agent to shared, cacheable HTML?
  21. Not answered. What does Age: 550 tell you?
  22. Not answered. Which responses should a shared CDN cache refuse to store by default?
  23. Not answered. What is the "stampede" that follows a hot key's expiry?
  24. Not answered. Which techniques genuinely mitigate a cache stampede on a hot key?
  25. Not answered. What is this 404-caching technique called, and what is its main risk?
  26. Not answered. With request coalescing enabled, how many requests reach the origin?
  27. Not answered. What's the difference between staleTime and gcTime in React Query?
  28. Not answered. Why does React Query refetch data it just rendered?
  29. Not answered. What happens when two components call useSWR('/api/user') within ~2 seconds?
  30. Not answered. Why does fingerprinting make cache invalidation almost a non-problem?