
- A user in Sydney requests a photo.
- The nearest edge location (Sydney edge) checks whether it already has the photo.
- On the first request, the Sydney edge fetches the photo from the origin object storage in Virginia, returns it to the user, and caches a copy locally.
- Subsequent Sydney users requesting the same photo get it directly from the Sydney edge — typically delivered in milliseconds instead of the multi-hundred-millisecond trip from Virginia.

- Offload origin bandwidth: If a celebrity posts a photo and millions view it, the CDN edges handle most requests; the origin often serves only one fetch per edge (when edges miss the cache).
- Improved global performance: Users experience lower latency and faster page load times.
- Cost efficiency: Reduced egress from origin object storage typically lowers bills.
If-Modified-Since or ETag) to check whether the file changed. If unchanged, the edge continues to serve the same object; if changed, it fetches the new version.
When you need immediate removal (for example, a user deletes a photo), you can explicitly invalidate or purge the object so edges drop their cached copies as soon as possible.


-
Conversation with your app servers (unchanged)
- The browser requests the feed from your application server.
- The app server queries the database and returns the feed. Photo URLs in the feed should point at your CDN domain (for example,
cdn.example.com) rather than the origin object storage.
-
Conversation with the CDN
- The browser requests the CDN URL.
- The CDN routing system (DNS, Anycast, or similar mechanisms) directs the browser to the nearest edge location (Sydney for Sydney users, London for London users).
- The edge serves the photo from cache, or fetches it from the origin if it does not have it.
- The browser asks your application server for the feed.
- The app server returns feed data with photo URLs pointing to the CDN.
- The browser fetches photos from the CDN domain.
- The CDN routes the request to the nearest edge.
- The edge serves photos from cache and contacts origin only on cache misses or validation.
When to use a CDN
- You serve large static assets (images, videos, binaries) to users in multiple regions.
- You want to reduce origin bandwidth and cost.
- You need consistent, low-latency delivery for a global audience.
Use a CDN when serving photos, videos, or other large static assets to a global audience: it reduces latency for users and offloads traffic from your origin.
- Common CDN features to evaluate: regional edge coverage, cache invalidation APIs, support for
ETag/Last-Modified, TLS, and signed URLs for protected assets. - Popular providers: Amazon CloudFront, Cloudflare CDN, Fastly.