# CDN usage and optimization — Web Performance Optimization

Source: https://www.geekswithgeeks.com/en/web-performance/web-perf-08

> Leverage Content Delivery Networks to reduce latency and improve global performance.

## CDN principles and selection

CDN caches content at edge locations closest to users, reducing round-trip time. Popular options: Cloudflare, AWS CloudFront, Akamai. Choose based on coverage, performance in your target regions, and pricing.

## CDN configuration best practices

Configure cache TTL, compression, HTTP/2 push rules, and geographic routing. Monitor cache hit rate (target >90%). Use origin shielding to reduce load on primary servers. Purge cache after deployments.

## CDN performance measurement

Monitor TTFB from different geographic regions. Use tools like Speedtest.net, WebPageTest with various locations. A/B test with/without CDN to quantify improvement (typically 30-50%).

Quick check

**Quiz:** What is a typical cache hit rate target for CDN?

- [ ] >90%
- [ ] >50%
- [ ] >70%
