08 / 25 · Traffic and capacity
CDN
A content delivery network serves suitable content from locations closer to users. It can cache public assets and reduce origin traffic. It does not make private or rapidly changing data safe to cache automatically.
What you will practise
- Follow edge hit/miss paths
- distinguish public/private responses
- use versioned asset URLs
Before you start: HTTP response, public asset and cache key.
About 4 minutes · offline-generated English female narration · captions included. Diagrams are conceptual; timings are illustrative.
Download MP4CaptionsListen without the video
Download audioChapters and full transcript
Let us understand cdn. A publisher places copies of a book in many nearby libraries. A student borrows locally instead of travelling to the printing factory. A personalized sealed letter should not be put on the shared shelf. Similarly, images and versioned scripts differ from private booking responses. A content delivery network serves suitable content from locations closer to users. It can cache public assets and reduce origin traffic. It does not make private or rapidly changing data safe to cache automatically.
Follow the normal path. A visitor requests a public poster. The content delivery network routes the request to a suitable edge location rather than always going directly to the origin. If the edge has a valid copy, it returns that representation. This can reduce both response latency and repeated origin transfer. SeatSpot posters and JavaScript bundles are useful near visitors. The booking API still needs authorization, correct seat state and an explicit cache policy.
Now change one condition. A missing or expired representation needs an origin fetch. The origin and its network path still matter for uncached work. A common misunderstanding is this: A CDN removes the origin from every request. Cache misses and dynamic requests still depend on the origin. Think about this. Can an account response use the same public cache policy as a versioned stylesheet? Pause the video and make your prediction. No. Private representations need deliberate cache keys and policies. Shared caching can leak another user’s response.
Let us reason with a concrete example. An illustrative 1 MB poster is requested 10,000 times. Uncached origin transfer would be about 10 GB in decimal units. A 90% edge hit rate would reduce those origin payload reads to roughly 1 GB, ignoring overhead and refresh behavior. Use explicit public asset policies and versioned filenames; treat booking/account routes separately. Costs, topology and actual hit rate depend on the provider and workload. These figures are teaching examples, not production guarantees.
Turn the idea into a design decision. When asset bytes change, publish a new content-versioned name. Long-lived immutable caching only fits a URL whose content will not change. An account or booking response may be personal and time-sensitive. Do not place it on the shared public cache path without a deliberately safe policy. When you try the practice task, look for this result. A content-hashed public file is a suitable immutable candidate; the account statement is not.
Check your understanding. Compare edge hits, misses and private requests separately. A fast cached poster does not show whether the booking API meets its latency and correctness objectives. Here is a challenge. A new logo is uploaded at the old immutable URL but users see the previous one. What is a safer release approach? Pause before the answer. Deploy the new asset under a content-versioned URL and update references. Confirm the production deployment, response headers and edge behavior; invalidate legacy copies if necessary. For an interview, defend cache keys, expiry and invalidation. Say what you would measure, not only which tool you would buy.
Start with an everyday picture
A publisher places copies of a book in many nearby libraries. A student borrows locally instead of travelling to the printing factory. A personalized sealed letter should not be put on the shared shelf. Similarly, images and versioned scripts differ from private booking responses.
Why SeatSpot needs this
SeatSpot posters and JavaScript bundles are useful near visitors. The booking API still needs authorization, correct seat state and an explicit cache policy.
Trace one step at a time
Move through the diagram at your pace. Teal paths are active; unavailable components are labelled.
Choose the route
A visitor requests a public poster. The content delivery network routes the request to a suitable edge location rather than always going directly to the origin.
Read all six mechanism steps
Choose the route
A visitor requests a public poster. The content delivery network routes the request to a suitable edge location rather than always going directly to the origin.
Return a cached asset
If the edge has a valid copy, it returns that representation. This can reduce both response latency and repeated origin transfer.
Fetch on a miss
A missing or expired representation needs an origin fetch. The origin and its network path still matter for uncached work.
Use a versioned URL
When asset bytes change, publish a new content-versioned name. Long-lived immutable caching only fits a URL whose content will not change.
Separate private data
An account or booking response may be personal and time-sensitive. Do not place it on the shared public cache path without a deliberately safe policy.
Measure each path
Compare edge hits, misses and private requests separately. A fast cached poster does not show whether the booking API meets its latency and correctness objectives.
Pause and make a prediction
Can an account response use the same public cache policy as a versioned stylesheet?
Correct a common misunderstanding
Claim to question: A CDN removes the origin from every request.
Better explanation: Cache misses and dynamic requests still depend on the origin.
Classify cacheable responses
- List a hashed CSS file, event poster and account statement.
- Assign public immutable or private/no-store policies with reasons.
- Change one asset and decide whether its URL must change.
Check what you can explain
This is your self-check, not an automated grade. Try again without the diagram tomorrow.
0 of 3 goals checked. Choose one remaining idea to practise next.
Teach it back
Without looking, explain what this component changes, what it does not solve and what happens if it fails. Use the animation to check your explanation, then switch to Engineering.
Engineering model and trade-offs
Distinguish origin, edge cache and cache key. Query parameters, request headers and cookies can affect the representation. A key that combines different users can expose private content.
Use content-hashed names for immutable assets and appropriate Cache-Control. Replacing bytes behind the same long-cached name can leave older copies visible until expiry or invalidation.
CDN routing and cache state vary by location. Measure real-user latency and origin errors. A cache miss, dynamic route or invalidation still depends on the origin.
Work through an example
An illustrative 1 MB poster is requested 10,000 times.
Reason with the numbers
Uncached origin transfer would be about 10 GB in decimal units. A 90% edge hit rate would reduce those origin payload reads to roughly 1 GB, ignoring overhead and refresh behavior.
Make a decision
Use explicit public asset policies and versioned filenames; treat booking/account routes separately. Costs, topology and actual hit rate depend on the provider and workload.
Implementation sketch
Cache-Control: public, max-age=31536000, immutable
# Suitable only when the URL changes with the content:
/assets/event-poster.7f3a9c.webp
# Example private account response:
Cache-Control: private, no-storeHeader examples, not a complete privacy policy. Verify behavior in browsers and intermediaries; do not apply an immutable public policy to personalized responses.
Where this is used
- Global delivery of posters, stylesheets and versioned bundles.
- Reducing repetitive public-content work at the origin.
Common mistakes
- Caching personalized responses without an identity-safe key.
- Calling every CDN request a cache hit.
- Replacing an immutable file without changing its URL.
Practise a reasoned answer
Answer aloud or write notes before opening the reference. These prompts teach reasoning and trade-offs; they are not claimed questions from a particular company.
Does a CDN remove the need for an origin?
Choose a practice depth
- Foundation
- Explain an edge hit and miss.
- Practical
- Defend cache keys, expiry and invalidation.
- Advanced
- Discuss regional hit rates, origin failures, personalization and bandwidth cost.
Self-check rubric
- State the required user outcome and the relevant invariant.
- Explain the normal path and one failure path.
- Name a cost or consistency/latency trade-off.
- Say what you would measure or test before trusting it.
For deeper practice, connect this topic to the previous lesson and identify a shared bottleneck. A longer answer is not automatically a better answer.
Try it before viewing the solution
A new logo is uploaded at the old immutable URL but users see the previous one. What is a safer release approach?
Check one key idea
Your explanation and interview notes
Saved only in this browser when storage is available. Export a backup from the course page before clearing browser data or moving devices.
Loading your local notes…
Official references and next reading
The explanation, fictional examples and animations are original teaching material. Vendor behavior depends on the specific product/version; use its documentation before deploying.