CDNs
Content close to users.
Shoply's servers are in London. A customer in Sydney waits a third of a second for every image, just because of distance. A content delivery network, or CDN, keeps copies close to every user.

- Servers in London
- A user in Sydney
- Distance costs time
How a CDN serves a file
ACDN has servers, called edge locations, in hundreds of cities. When the Sydney user asks for a product image, the request goes to the nearest edge. If the edge already has the image, it returns it straight away. If not, it fetches it once from Shoply's origin server, keeps a copy, and serves everyone after that.
- User in Sydney
- Nearest edge
- Cached? Return it
- Else: origin
- Keep a copy

What to put on a CDN
CDNs are perfect for static files, that are the same for everyone. Images, videos, style sheets, and JavaScript. Many can also cache some API responses. The benefits are big. Faster pages, much less load on your servers, and protection from traffic spikes.
| key | value |
|---|---|
| Images and video | the biggest win |
| CSS and JavaScript | same for everyone |
| Less origin load | edges do the work |
| Spike protection | absorbs huge traffic |
Summary
ACDN copies static content to edge servers near users, making pages faster and protecting your servers. Next, a server that sits in front of your servers.
Key takeaways- Edges near users
- Fetch once, serve many
- Best for static files