What is a Content Delivery Network (CDN)?
Introduction
AContent Delivery Network (CDN),as the name implies, is a network of servers for the purpose of delivering website content. Although web servers are primarily responsible for serving a website’s content on the World Wide Web, a CDN can improve user experience by decreasing the distance between a user and the content (resulting in lower latency and improved throughput).
CDNs are now very popular and used by websites with massive traffic such as Facebook and Amazon to provide a fast experience no matter the user’s geographical location.
Website experience without a CDN
Before CDNs became popular, content on the World Wide Web was mostly served from the same physical web server which a website was hosted on. This server is also called the origin server, because all the content of a website originates from this server. Without a CDN, all the content of a website will be served out of the origin server regardless of whether the request comes from a web browser in China, Italy, or Brazil.
The website experience of different end users differs depending on their location. For example, if the origin server of a website is located in Rome, Italian web users will experience decreased latency and faster web page loading times. Users in China and Brazil will experience high latency and slower web page loading because data has to be transmitted over a much longer distance.
Experience with a CDN
CDNs can vastly improve the latency and loading times of web pages, because most of a website’s content need not be served out of the origin server and can be served out of servers physically located close to the end user called edge servers.
Let’s use an analogy to illustrate why CDNs are so useful. Imagine if you order - say - a new phone. Rather than having a single warehouse in a country half-way across the world, the company selling the phone(s) will have a warehouse (ideally) in the same country.
This is roughly how CDNs work -- data isphysicallycloser to end-users, much like a warehouse of products. This results in faster delivery times - or in the case of CDNs, faster page load times. There is a caveat: most CDNs do not have a "facility" - or edge server - in the same city as every user. So, users will have usually have to contend with data within acloseproximity, but the general experience for users should still be improved.
Reducing bandwidth cost using a CDN
So far, the benefits of a CDN that have been discussed are from the users’ end. From the perspective of a website owner, other than providing a much better experience for the end user, a CDN also helps to reduce the overall cost of delivering content.
For very popular websites, bandwidth on the origin server is a major expense. The origin server does not consume as much bandwidth since most of the content served to its end users uses the bandwidth of the edge servers. This reduces the cost of bandwidth on the origin server, which uses a much smaller amount of bandwidth to serve content to the edge servers (usually a single time). Therefore, by using a CDN, a popular website can serve the same number of users at a lower cost.
Security improvements using a Content Delivery Network
By using a CDN, a website gains additional security and protection from some forms of distributed denial of service (DDoS) attacks. DDoS attacks generally seek to overwhelm an origin server with a large volume of requests such that the origin server is unable to respond to all the requests and freezes, which brings the website down.
With a CDN, most content delivery requests are distributed from the edge servers instead of the origin server. Therefore, it is harder for the attacker to target the origin server directly. Even if an origin server goes down due to a DDoS attack, to the end user, the website remains up and running as content is served from the edge server's cache instead of the origin server.