CDN
You might say
People far away say the images load slowly. Can they download them from somewhere closer?
Serve static files from locations closer to visitorsA content delivery network caches images, scripts, styles, and sometimes pages across many edge locations. It can reduce latency and protect the origin from repeated traffic. Plan cache rules and invalidation so visitors do not receive outdated files.
When to use it
- Deliver images and static assets
- Reduce latency across regions
- Cache public files with stable versions
- Absorb repeated requests before they reach the origin
When NOT to use it
- Cache private or personalized responses as public
- Change a file without updating or invalidating its cache
- Assume a CDN fixes slow application logic
- Ignore cost and regional requirements
Anatomy
🖥️Origin→📍 Hong Kong node 18ms📍 Frankfurt node 22msCache for 30 days
The origin is contacted only when an edge node does not have the requested file.
An edge location near the user that caches files and serves them directly
How long an edge node keeps a cached file before fetching a fresh copy from the origin
Variants
Static Assets
cdn.vibeui.dev/logo.png
Images, JS, CSS are sent to edge nodes
Full Site
vibeui.dev Edge
HTML also uses nodes, and dynamic parts return to the source
OSS + CDN
uploads.vibeui.dev/u/8f2k.jpg
Images uploaded by users are also sent to CDN
Typical use cases
Image delivery
🚀
Deployed successfully
vibeui.dev updated in 38 seconds
✓ Distributed to 26 edge nodes
Static resources are accelerated by global CDN, and the HTTPS certificate has been automatically renewed
JavaScript assets
Edge node · Real-time delay
📍 Hong Kong
Services: Shenzhen, Guangzhou
18ms
📍 Frankfurt
Services: Berlin, Paris
22ms
📍 Los Angeles
Services: San Francisco, Seattle
26ms
For the same batch of files, each user will fetch them from the nearest node
Global website
CDN cache · Last 7 days
Cache hit rate
92.4%
Back to origin request
7.6%
Save origin site bandwidth
86 GB
More than 90% of requests are resolved at the node, and the origin site has almost no pressure
Download files
Refresh cache
Let global nodes discard old files and go back to the source to get the latest version
✓ 26 nodes have been refreshed and will take effect globally in about 30 seconds
Further reading