System designInterview preparation
Advanced·Concept·2 min read

Cache, CDN, replica or shard: which solves what?

Practice this question

Definition:

Caches, CDNs, replicas and shards address different kinds of repeated work or load. A cache reuses a result, a CDN brings cacheable content closer to users, a replica copies data, and a shard owns a subset of data. Combining them requires freshness, routing and recovery rules rather than simply adding more boxes.

Key points:

  • Cache avoids repeated work; CDN serves cacheable content near users.

  • Read replicas spread reads but may lag behind writes.

  • Shards split data across nodes; choosing the shard key adds design complexity.

  • A read replica may serve stale data, while a shard changes where authoritative data is stored and which node a query must reach.

Interview point:

  • Connect each component to a measured bottleneck and describe its failure behavior.
Adapted from 07_SYSTEM_DESIGN_ARCHITECTURE.md · “Cache, CDN, replica or shard: which solves what?”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.