Content Delivery Networks: An Introduction
CDN internals for edge caching, request routing, origin shielding, and asset delivery.
A content delivery network, or CDN, is a distributed layer of edge servers placed between users and your origin infrastructure. The reason it exists is simple: distance, repetition, and traffic spikes are expensive. If every browser around the world must fetch every image, script, video segment, and download from one origin region, latency rises and the origin does the same work again and again.
A CDN changes that path. When a user requests a cacheable asset, DNS resolution or anycast routing sends the request to a nearby point of presence. If the edge server already has the object, it returns it immediately. If not, the CDN fetches the object from the origin or an upper-tier cache, stores it according to policy, and serves it back. Future users near that edge can then reuse the cached copy.
This improves more than page speed. It also protects the origin from repeated work. A marketing launch or news spike might send millions of users for the same JavaScript bundle or hero image. With a good hit rate, the origin may only serve the first miss at each edge location rather than every request globally.
Caching policy is where the useful detail lives. The CDN needs a cache key that decides which requests count as the same object. Sometimes the URL alone is enough. Sometimes query parameters, headers, or cookies matter. If the cache key is too broad, users may receive the wrong variant. If it is too narrow, the hit rate collapses because every small difference creates a new cached object.
Freshness rules matter just as much. Cache-Control headers, TTL settings, revalidation rules, and purge mechanisms decide how long the edge may reuse content and how quickly updates propagate. This is why versioned static assets are so common. They let teams cache aggressively while still rolling out changes safely. A CDN with weak invalidation practice can serve stale content extremely efficiently.
Modern CDNs also add security and transport features. They often terminate TLS, compress responses, block abusive traffic, enforce rate limits, and apply web application firewall rules. Some platforms support edge logic for URL rewriting, lightweight personalisation, or origin selection. These features are powerful, but they also mean debugging may involve behaviour at the edge that never existed in the application server.
CDNs are not a free win for every response. Highly personalised pages, user-specific dashboards, and rapidly changing resources may be hard to cache well. Query-heavy APIs can also defeat caching if every request is unique. The best CDN strategy starts by identifying what is actually reusable across users, sessions, and geographies.
For beginners, the key idea is this: a CDN is controlled reuse at network scale. It improves latency and resilience when cache keys, TTLs, and purge behaviour match the shape of real traffic. It disappoints when teams enable it without understanding freshness, personalisation, and which responses were never good cache candidates in the first place.