CDNs, make the world feel closer
A Content Delivery Network (CDN) caches and serves public assets from edge locations close to users. It reduces latency, lowers origin load, and provides edge security features like DDoS protection and WAFs.
When to use a CDN
- Public static assets (images, JS, CSS) and cacheable API responses.
- To reduce TTFB for geographically distributed users or to handle bursty traffic.
Configuration tips
- Use immutable URLs / content-hashed filenames for long-lived assets.
- Set cache-control and CDN-specific headers correctly for desired TTL and revalidation behavior.
- Configure origin failover and tiered caching where beneficial.
Operational notes
- Purging: provide fast purge APIs for urgent invalidation; avoid relying solely on short TTLs.
- Cost: CDNs reduce origin costs but introduce egress and request costs; measure and optimize.
- Security: enable edge protection features and be careful when caching personalized content.
Recommendation
- Add a CDN early for public assets. It usually pays back in performance and operational simplicity.
Continue reading
Next article
Choosing a database, practicality over purity
Related Content
Caching, when to add it and how to avoid headaches
Best practices for caching layers, invalidation strategies, common failure modes, and practical patterns to reduce latency and backend load.
FastAPI Performance Optimization - Production-Grade Techniques
Deep dive into FastAPI performance optimization: database connection pooling, caching strategies, async patterns, profiling, and real benchmarks from production systems.
Database sharding, splitting data without losing your mind
A practical look at sharding strategies, design trade-offs, rebalancing, and operational tips for partitioning large datasets.