News | Blog Hosting
Editorial photograph illustrating the subject of this intraweb.host article

Browser cache, server cache and CDN cache: what is the difference?

Summary

Caching can make a website dramatically faster, but the word “cache” describes several layers that store different things in different places.

The browser is the closest cache to the visitor

A browser can keep copies of static resources such as images, stylesheets and scripts according to HTTP caching rules. On a repeat visit, those files may not need to travel across the network again. This reduces transferred data and can make navigation feel much faster, but it also explains why a visitor can occasionally see an older asset until its cache is refreshed or expires.

Server-side caching reduces repeated work

A dynamic application may normally execute PHP, query a database and build HTML for every request. Page or object caching can avoid part of that work when the result is reusable. This is especially valuable for content that is requested frequently but changes relatively rarely. The configuration must still know what should never be shared, such as personalised account or checkout information.

A CDN moves reusable content closer to users

A content delivery network can cache suitable responses at edge locations distributed across different regions. Visitors may then receive cached content from a nearby edge instead of requesting every object from the origin server. This can reduce latency and origin load, but the origin remains important: cache misses, dynamic requests and refreshes still need it.

Good caching is coordinated, not simply aggressive

More caching is not automatically better. Long lifetimes can make updates harder to propagate, while very short lifetimes lose much of the performance benefit. A good strategy defines which content can be cached, for how long, how it is invalidated after changes and which layer is responsible. When browser, application and CDN caching work together, performance improves without sacrificing correctness.

Share: Facebook LinkedIn X Email