System Design for DevOps · Module 03
Data, Caching and CDN
Where data lives and how it gets to users fast: pick SQL or NoSQL by access pattern, scale databases with replicas and shards, reason about consistency with CAP and quorums, cache with the right pattern and eviction policy, and push content to the edge with CDNs and multi-CDN.
What you will learn
- Choose SQL or NoSQL from the access patterns and consistency needs
- Add read replicas, understand replication lag, and pick a shard key
- Explain CAP, strong vs eventual consistency and quorum reads and writes
- Apply cache-aside, write-through and eviction policies such as LRU
- Serve static content through a CDN and explain the benefits of multi-CDN
Lessons
- SQL vs NoSQL: Choosing a Database
Relational databases give schemas, joins and transactions; NoSQL stores (key-value, document, wide-column, graph) trade some of that for scale-out and flexible schemas. Choose by access pattern, consistency and scale.
- Replication and Sharding
Replication copies data to more nodes for read scale and failover; sharding splits data across nodes so each holds a part. Replicas bring replication lag; shards need a good shard key and make cross-shard queries harder.
- CAP, Consistency and Quorums
During a network partition a distributed store must choose between consistency and availability (CAP); consistency models range from strong to eventual, and quorum reads and writes (R + W > N) give tunable guarantees.
- Caching Patterns and Eviction Policies
A cache keeps frequently read data in fast memory close to the app; cache-aside, read-through, write-through and write-back decide how cache and database stay in sync, and eviction policies such as LRU, LFU and FIFO decide what to drop when memory is full.
- CDN and Multi-CDN
A CDN caches content at edge locations close to users, cutting latency and origin load; cache keys, TTLs and invalidation control freshness, and multi-CDN spreads traffic across providers for resilience, performance and cost.