Stop 02 · Networking Fundamentals for CloudTopics · 8/9

CDNs (Content Delivery Networks)

Part of the Cloud Computing Roadmap

In short

A user in Guwahati shouldn't wait for every image to travel from a server in Virginia. CDNs keep copies close to users, which makes sites feel quick and keeps your main server calm.

A globally distributed network of edge servers that caches content close to users, reducing latency and offloading traffic from your origin servers — CloudFront, Cloud CDN, and Azure CDN are the major providers' offerings.

The blob character hands out milk packets from a small street-corner milk stall.

Think of it like this

The milk booth on every corner

Nobody drives to the dairy plant for a packet of milk. The dairy sends stock to small booths in every area each morning. A CDN does that with your images, videos and scripts.

Watch it happen

First visit vs second visit

User in Pune
Edge (Mumbai)
Origin server

GET /hero.jpg

1/6DNS sends the user to the nearest edge location instead of your main server.

The big ideas

What you need to know

Edge locations

CDNs run servers in many cities. Each one keeps copies of popular files close to the people asking for them.

Lower latency

Data travels a shorter distance, so pages load faster, especially for images, video and big JavaScript files.

Origin protection

Most requests stop at the edge, so your origin handles far less traffic and survives sudden spikes.

Cache headers control it

Cache-Control tells the CDN how long a file may be reused. Get this wrong and users see stale content.

See it in code

Walk through the code

http
1# Response from your origin for a hashed static file2HTTP/1.1 200 OK3Content-Type: image/jpeg4Cache-Control: public, max-age=31536000, immutable5 6# Response for the HTML page itself7HTTP/1.1 200 OK8Content-Type: text/html9Cache-Control: public, max-age=60

1/2A year-long cache is safe because a new version gets a new file name.

Files with a hash in the name (app.3f9a.js) can be cached for a year. HTML changes often, so give it a short life.

Save yourself the pain

Common mistakes

Oops

Caching HTML for a day, then wondering why the new release isn't showing.

Do this instead

Cache HTML briefly, cache hashed assets for long, and invalidate the CDN when you must.

Oops

Putting a CDN in front of personalised pages without thinking.

Do this instead

Pages with user data must not be cached publicly. Mark them private or no-store, or one user may see another's page.

Your mission

Catch a CDN in the act

~15 min

Quick check

A user gets a 'cache HIT' from the CDN. What happened?

Go deeper

  1. 1Set up a basic CDN distribution in front of a static website or storage bucket.
  2. 2Learn why a CDN dramatically improves load times for users far from your primary region.
  3. 3Understand cache invalidation and why stale cached content can be a real operational headache.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge