What is a CDN?
- A CDN is essentially a group of servers that are strategically placed across the globe with the purpose of accelerating the delivery of your static web content.
- CDNs are very useful for a multitude of reasons:
- For website owners who have visitors in multiple geographic locations, content will be delivered faster to these users as there is less distance to travel.
- CDN users also benefit from the ability to easily scale up and down much more easily due to traffic spikes.
What is an origin server?
- The origin server is, in this case, the primary source of your website’s data and where your website files are hosted.
What is an edge server?
- Edge servers are the CDN servers used to cache content retrieved from your origin server or storage cluster.
- Another term often closely related to edge server is point of presence (POP).
- A POP refers to the physical location of where the edge servers are located.
What are CDN reverse proxies?
- A reverse proxy is a server that takes a client request and forwards it to the backend server.
- It is an intermediary server between the client and the origin server itself.
- A CDN reverse proxy takes this concept a step further by caching responses from the origin server that are on their way back to the client.
- Therefore, the CDN’s servers are able to more quickly deliver assets to nearby visitors.
- This method is also desirable for reasons such as:
- Load balancing and scalability
- Increased website security
How does CDN caching work?
- In the case of a CDN, the edge servers are where the data is cached and stored.
- CDN caching works as follows:
- A visitor in a particular location makes the first request for a static asset on your site.
- The asset is retrieved from your origin server and upon being delivered, the asset is cached on the edge server
- If the same visitor makes a request for the same asset again, the request goes to the CDN POP edge server(s) to check if the asset is already cached.
- This is shown as the
X-Cache: HITwhich means it was delivered from the edge server. X-Cache: MISSmeans it was from the origin server.
Push and Pull Zones
- A Pull Zone will pull files from an existing website without having to upload data manually.
- A Push Zone requires data to be upload to the CDN storage cloud.
- Typically recommended for distributing larger files, like files larger than 10 MB, and is required for files larger than 100 MB.
Source: https://www.keycdn.com/support/how-does-a-cdn-work
