April 21, 2021 • 7 min read
Single server versus Content Delivery Network (CDN) by Kanoha on Wikimedia Commons
A Content Distribution (or Delivery) Network (CDN) is a group of servers distributed geographically with the purpose of providing fast delivery of Internet content.
The CDN's servers act as reverse proxies for your origin servers, where the content is hosted.
Servers are contained in facilities called Points of Presence (PoP), which are spread around the globe.
Servers in a CDN can help provide a better user experience by caching content closer to the user and delivering it instead of the origin server.
This reduces the Round Trip Time (RTT) which is the number of milliseconds (ms) it takes for a browser to send a request and receive a response back from a server.
Without CDN vs with CDN by Imperva
GET http://example.com/index.htmlGET http://example.com/index.htmlAt this point, there are 2 possible outcomes:
The asset remains cached on the PoP’s cache server until the time-to-live (TTL) specified by its HTTP headers expires.
The most obvious benefit is the better UX caused by the faster RTT that comes with using cached content in proximity to the user.
Beyond that, using a CDN can result in increased uptime on a website. Imagine a traffic overload or a hardware failure that incapacitates your origin server. Having cached content on the distributed CDN’s servers can prevent interruptions on the service for end-users. Moreover, since the content is redundant in the CDN’s servers, a failure in one PoP can be saved by the content on another PoP.
Another benefit is that by serving cached content, bandwidth costs on the origin server are reduced. However, the CDN provider might charge a substantial fee, making this benefit tiny, so take this point with a grain of salt!
Also, it is worth noting that some CDN providers, by leveraging the reverse proxy configuration, are crossing to other services. Some use the CDNs distributed configuration to provide protection againstDistributed Denial of Service(DDOS) attacks. Also, they may implement load balancers to avoid overloading origin servers with huge amounts of traffic.
At the time of writing, there are 6 major types of CDN:
When CDNs were starting to appear in the late 90s, they were really expensive so not all organizations could afford them.
Nowadays, the reductions in cost have made CDNs a more accessible option, and many hosting providers actually offer CDN services as a checkbox add-on.
Hope you found it interesting. If you want to learn more, you can find the resources I used to research this topic in the next section. The Imperva one is really well explained.
Keep learning, and have a good day!
Jon Portella