#🧱 Building Block: Content Delivery Network (CDN)
#Overview
A CDN is a geographically distributed group of servers that work together to provide fast delivery of Internet content.
#Key Concepts
- Edge Locations: Data centers located close to users to reduce latency.
- Push CDN: Content is pushed to the CDN when updated on the origin.
- Pull CDN: CDN fetches content from the origin on the first request (more common).
- TTL (Time To Live): Defines how long content remains cached at the edge.
#Benefits
- Reduced Latency: Bringing content closer to users (lower RTT).
- Reduced Bandwidth Costs: Offloading traffic from the origin server.
- DDoS Protection: Absorbing large-scale attacks at the edge.
#When to Use
- Static Assets: Images, CSS, JS, videos.
- Global Audience: When users are spread across different geographical regions.
#Trade-offs
- Pros: Significant performance boost, increased reliability.
- Cons: Cache invalidation is hard, potentially stale content, cost.