All ArticlesTechnical Infrastructure

CDN, Caching, and Page Speed: A Practical Performance Guide

2026-10-05

A site's speed depends on how the code is written and on the route its files take to reach the visitor. A CDN and caching are the two basic tools that shorten that route. In this article we cover what each does and how to set them up for page speed.

What Is a CDN and What Does It Solve?

A CDN is a network that keeps copies of your site's files on servers in different parts of the world. When a visitor requests a file, a server close to them usually answers. The shorter distance lowers latency and takes load off your origin server. If your visitors are concentrated in one country, the gain may be smaller, and if they come from several countries, the difference is more noticeable.

Caching Works in Three Layers

A cache isn't a single place. The browser cache keeps the file on the visitor's device. The CDN cache stores it on servers in the network. Server-side caching keeps a page or a database result ready on the origin server. The three layers complement each other. Each removes a different kind of slowness, so you need to measure to find out which one fixes your problem.

Cache-Control Headers

How long a file is kept is set by the Cache-Control header the server sends. A long duration makes sense for files that never change, a short duration or no caching at all for pages that change often. A wrong setting does harm in both directions. If the duration is too short, the cache is useless, and if it is too long, visitors keep seeing old content.

Version Names for Static Files

Adding a content-based version to the names of image, CSS and JavaScript files (for example a hash in the file name) makes it safe to cache them for a long time. When the file changes, its name changes too, and the browser downloads the new file again. That removes the risk of an old version getting stuck.

Compression and Images

Compressing text-based files with Brotli or gzip reduces the data transferred. Images are the heaviest part of the page on most sites, so converting them to a suitable size and a modern format speeds things up regardless of caching. Some CDNs also offer image transformation.

What Should You Not Cache?

Personalized pages, responses that contain session information and payment steps should not be kept in a shared cache. Showing one visitor's account page to someone else is a serious security problem. Defining clearly which paths get cached is always safer than letting everything through.

Clearing the Cache After a Release

When a new version of the site goes out, the old copies on the CDN need to be cleared. Otherwise some visitors see old content. Most CDNs let you purge specific addresses or the entire cache. Adding this step to the release process prevents the "I made a change but it isn't showing" problem.

Conclusion

Set up correctly, a CDN and caching improve page speed noticeably, and set up wrongly, they bring stale content or security problems. In our site performance service we plan these settings around your site's structure. Get in touch if you'd like to review your current setup together.

By the way, you're proof of this right now.

If you found this article through a search, you're a live example of exactly what we're writing about – showing up when it matters. We don't just do this for ourselves, we do it for our clients. Let's talk about doing the same for your business →

Frequently Asked Questions

Does every site need a CDN?

No. For a small site whose visitors are in a single region, the gain may be limited. Sites with visitors from different countries or with many static files benefit more.

Does caching solve page speed on its own?

No. Heavy images and unnecessary scripts cause slowness even with caching. Caching is a tool that works alongside other improvements.

What should I do if old content shows because of caching?

Clear the CDN cache first, then review the Cache-Control durations. For content that changes often, you may need to shorten the duration.

How do I measure the speed improvement?

You can measure before and after with PageSpeed Insights and the browser developer tools. The Core Web Vitals report in Search Console also helps for real user data.

Let's assess your site's GEO and SEO status

Contact Us

More Articles