Caching easy
Which of the following is the best candidate for caching on a Content Delivery Network (CDN)?
- A An internal API endpoint that returns the current real-time ledger balance for a specific authorized user account.
- B A static JavaScript utility library (e.g., jquery.min.js) that is fundamentally identical for every user of the system.
- C The dynamically generated search results page for a unique, one-time query that is unlikely to be repeated by others.
- D The internal database transaction log used for auditing and recovery purposes within the primary data center.
Answer: B. A static JavaScript utility library (e.g., jquery.min.js) that is fundamentally identical for every user of the system.
**Content Delivery Networks (CDNs)** are designed for 'write-once, read-many' static assets like images, CSS, and JavaScript libraries. Since these files rarely change, they can be cached at edge locations around the world for long periods, maximizing the offload from your origin server.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- In the Cache-Aside pattern, what happens when the application requests data that is missing from the cache (a 'Cache Miss')?
- Why use a centralized Distributed Cache (like a Redis Cluster) over local in-memory caches on each web server?
- Setting a short TTL (e.g., 60 seconds) on a cached object helps to:
- What is the primary architectural goal of introducing a cache into a system?
- Most caching systems rely on the principle of 'Temporal Locality', which states:
- Your cache uses an LRU (Least Recently Used) eviction policy. When the cache is full, which item is removed?