Have you ever noticed that a website takes a little longer to load the first time, but feels much faster when you visit it again?

That's not a coincidence. Two important technologies help make this possible: browser caching and Content Delivery Networks (CDNs).

What is browser caching?

Imagine Sam opens a website and downloads a photo of a cinnamon roll.

The first time, his browser needs to fetch the image over the internet. But instead of downloading it every time, the browser can store a copy locally.

When Sam visits the website again, his browser may reuse that stored image.

This is called browser caching.

It helps reduce:

  • Page loading times
  • Network requests
  • Bandwidth consumption
  • Server workload

What is a CDN?

Now imagine Sam's friend Alex visits the same website from another country.

Downloading the image from a distant server might take longer.

A Content Delivery Network (CDN) uses geographically distributed servers that can store copies of website resources and deliver them from a nearby location.

When Alex requests the image, a nearby CDN server may already have a copy ready to deliver.

Cache hit vs. cache miss

  • Cache hit: A reusable copy is already available in the cache.
  • Cache miss: The requested resource is not available in the cache, so it needs to be fetched.

What happens when the image changes?

Cached resources aren't necessarily stored forever.

Expiration rules, cache validation, and versioned URLs help ensure that users receive updated content when necessary.

Caching is about balancing speed with freshness.

Watch it happen

In Episode 4 of WattaDumb Explains — Behind the Click, I explain browser caching and CDNs through a simple animated story featuring Sam, Alex, and a cinnamon-roll photo.

No complicated terminology. Just everyday examples to help you understand how the web works behind the scenes.

If you found this helpful, a follow or subscription would be appreciated.

Thanks for reading!