Scaling / 5 / 5
CDN and edge caching
A shop's server sits on one continent, its buyers on another. Images and scripts move to edge caches near the users: how a request reaches the edge, when it goes back to the origin, how to replace a file and what must never be cached.
- 12 min
- Beginner
- 12 steps
- Page load p95
- 1 900 ms
- Edge hit ratio
- 0 %
- Requests to origin
- 1 200 /s
- Wrong content served
- 0 %
- request
- reply
- redelivery
- duplicate
- lost
Numbers are a model scenario, not measurements
The real request
Buyer, region A → Origin serverRequest
GET /img/sofa-1042.jpg HTTP/1.1
Host: shop.example.com
Response
HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Length1: 412000
Server-Timing2: total;dur=1870
Content-Length— 412 KB for one photo. The same bytes leave the server for every visitor.Server-Timing— 1870 ms in total. Most of it is distance, not work.
Course: 42 lessons
01 Foundations
02 Scaling
03 Data & storage
04 Communication
05 Reliability
06 Architecture
07 Security
08 Shipping
09 Whole systems
10 Business processes