Performance
Content delivery network
Also called CDN.
Content delivery network is a set of servers spread around the world that hold copies of your files close to visitors. Static assets, and sometimes full pages, are served from the nearest location instead of your origin.
How it is measured
Compare time to first byte for a static file from a city far from your origin, with and without the CDN. Check the response headers for a cache status and an `age` value, which show whether a copy was served from the edge.
Latency follows distance. A CDN cuts round trips by terminating TLS close to the visitor and answering from cache. For uncached requests it still reduces setup cost by keeping warm connections back to the origin.
Worked example
A Sydney visitor loads an Astro site hosted in Virginia. The HTML takes 780 ms TTFB from the origin. Behind a CDN with a cached copy in Sydney, TTFB is 62 ms. A request that misses the cache measures 410 ms, because the edge still has to reach Virginia.
After purging by tag instead of the whole zone, the next 100 requests produce 6 misses and 94 hits, and no visitor sees a cold start.
How it differs
A CDN is the network. An edge cache is the storage inside it. The origin is your own server that the CDN falls back to on a miss. The CDN does not make a slow origin fast on uncached routes, it only hides it when the cache has a copy.
Common errors
Assuming a CDN speeds up everything when HTML bypasses the cache. Caching responses that carry Set-Cookie. Forgetting to purge after a deploy. Leaving the origin open so people can bypass the CDN. Putting uncached dynamic APIs behind it and expecting gains. Ignoring regional gaps in coverage.
In practice
Test TTFB from two or three distant regions before and after. Set Cache-Control so the CDN may store static assets and cacheable HTML. Lock the origin to CDN traffic, and watch the cache hit ratio for the first week.