Definition
A Content Delivery Network (CDN) is a collection of global servers that cache and deliver content such as images, videos and Javascript files. When a user requests a web page, for instance, content on that page is delivered by the closest edge server rather than the origin server, thereby decreasing page load time.
Overview
Performance, reliability and bandwidth are major factors for online service providers that directly impact profitability and customer satisfaction.
A CDN is a distributed group of servers that can withstand high amounts of traffic, provide inexpensive data transfer costs, and provide reliability. Many websites and online services rely on CDNs as a cost-effective way to improve uptime and performance.
How A CDN Works
Typically, when a user visits a website, their browser downloads every referenced asset (images, videos, CSS/Javascript) from a single origin server. If the origin is in New York and the user is in Japan, each asset must be downloaded from across the world. In a case like this, users experience longer page load times due to higher latency.
A CDN distributes files to servers around the globe, reducing the time needed to access a file. For example, users in Japan could download files from a nearby server in Asia instead of one in North America.
Here’s a step-by-step description of how a CDN works:
- The website administrator for
example.com
(the origin server) signs up with a CDN provider. The CDN provider gives the administrator a URL for the CDN such asexample.some-cdn.com
. - The website administrator configures the site to load assets (images, videos, CSS/Javascript files) from the CDN URL instead of the origin server. With software like Wordpress, this change can be made using a plugin.
- A user opens
example.com
in their browser. The browser requests assets that are referenced inside the page using a CDN URL such ashttp://example.some-cdn.com/image.png
. - The CDN automatically distributes incoming requests to the nearest CDN server, using technologies like DNS load balancing and Anycast routing. Files not already on the CDN are downloaded from the origin server and stored.
- The browser downloads assets from a nearby CDN server, thereby improving performance and reducing traffic for the origin server.
CDN providers use additional techniques to optimize the delivery of files, such as compression, caching and special HTTP headers.
Example of a CDN
Many websites use third-party libraries like Twitter Bootstrap to improve their layout or functionality. However, the administrator may not want to host the libraries directly, which costs bandwidth and may involve maintenance and updates.
Services like Bootstrap CDN let users load the CSS and Javascript files for Twitter Bootstrap from a CDN. This reduces server load and speeds up access for users. Additionally, users can avoid re-downloading the files if they’ve already visited a site that uses the same files on Bootstrap CDN.
Benefits of a CDN
A CDN offers numerous benefits for a website or online service:
- Users experience faster load times because assets are downloaded from local servers instead of faraway ones.
- Enterprises save on bandwidth costs since CDNs can purchase bandwidth in bulk and pass this discounted rate to their customers.
- Enterprises reduce server load because asset requests are routed away from the origin server.
- Enterprises improve server reliability as CDNs are part of failover plans to route traffic to new locations should a server be taken offline.
Conclusion
CDNs are a popular way to distribute traffic, and nearly a requirement in order to run a fast, reliable website at scale. Also, the vast majority of the top 10k websites rely on a CDN.
If you have any questions about the content of this article, please feel free to reach out to the Support Team for assistance, we're available 24/7 for your convenience.