Typorithm · easy

CDN & Edge

cdn-staticsystem-designcdnedgestatic
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn CDN & Edge

0%

Scaling

A CDN caches static content at edge points of presence close to users, cutting latency and offloading the origin. Pull CDNs fetch on the first request, push CDNs are pre-populated; Cache-Control headers govern TTL; and edge compute runs logic near the user.

A CDN (content delivery network) is a global mesh of caches at points of presence (PoPs) near users. By serving content from a nearby PoP instead of a distant origin, it cuts latency and absorbs traffic the origin would otherwise handle.

CDNs excel at static assets — images, stylesheets, scripts, and video — that are identical for every user. The origin can be filled two ways: a pull CDN fetches an asset from the origin on the first request for it, while a push CDN is pre-populated before any request arrives.

Cache-Control response headers set the TTL, telling each PoP how long to serve a cached copy before revalidating with the origin. Beyond caching, edge compute lets you run small pieces of logic at the PoPs themselves, so personalization or routing happens close to the user.

01

A CDN caches assets at edge PoPs near users.

02

Pull fetches on first request; push is pre-populated.

03

Cache-Control headers set the TTL.

cdn:
  purpose: serve-near-user
  content: static-assets-cache
  origin: pull-or-push
  ttl: cache-control-headers
  edge: compute-at-edge

Read the implementation

Connect each part of the code to the concept before you type.

1. CDN purpose

A CDN caches content at points of presence close to users, cutting latency and offloading the origin server.

purpose: serve-near-user

2. Cached content

CDNs are best at static assets — images, CSS, JS, video — that are the same for every user and rarely change.

content: static-assets-cache

3. Origin model

A pull CDN fetches from the origin on the first request for a path; a push CDN is pre-populated by you ahead of time.

origin: pull-or-push

4. Cache TTL

Cache-Control headers tell the CDN how long to keep an asset before revalidating with the origin.

ttl: cache-control-headers

5. Edge compute

Edge compute runs small bits of logic at the points of presence, close to users, instead of at a central origin.

edge: compute-at-edge

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

CDN & Edge: Lesson & Practice · Typorithm | ApplyDjinn