A CDN (Content Delivery Network) is a popular service used by websites to streamline and manage the speed and performance of its assets to visitors. Read on to learn more about the benefits of a CDN, disadvantages if any and to help determine whether your website need a CDN.
As your web site grows, you may face the dilemma of how to optimize the delivery of its content over the Internet. At first, when your site was a small collection of static text and images, it was simple enough to host all its content on a single web server. But if your site now features dynamic content with extensive video and other high-bandwidth media, it can easily become overwhelmed and suffer from bandwidth overages, slow responsive times, and even crashes. A single-server solution might no longer cut it.
Imagine a small-town flower shop that sets up a delivery service. For the first few months, the shop owner delivers everything herself by bicycle. As her customer base grows, she buys a car and then a van to handle the growing volume. Eventually, as the business flourishes, she contracts with a courier company to handle the deliveries of most orders. Finally, she sets up a few locations in other cities where flowers can be grown and delivered more quickly to nearby customers.
In this flower shop analogy, the bicycle is your single-server web site with an entry-level service package. Upgrading to a car or van is like upgrading your web hosting to a better service package. So far, so good. But when you need to handle many more customers, you contract with a courier company or open satellite depots. This is where a Content Delivery Network (CDN) comes in.
Content Delivery Networks have come a long way since we first detailed their pros and cons, back in 2013. Modern CDNs are much more complex, with significant implications for security and reliability as they handle many times more data than earlier. Below, we cover the benefits of using a CDN in 2020:
Benefits of a CDN
CDNs allow you to offload some or all of the job of serving your site to a distributed network of servers on the Internet. These servers are geographically distributed so that visitors can reach them faster than they could reach your primary web server. (To learn more about how a single logical Internet host can be served by many far-flung physical hosts, read up on DNS and IP Anycast.)
Because CDNs typically serve content from third-party hostnames, they can help increase the number of simultaneous connections that a web browser is able to make while it is fetching and rendering a page. This can provide a performance improvement, even if the CDN servers are no faster than your primary web server. (Mind you, the adoption of HTTP/2 has allowed many servers and browsers virtually unlimited simultaneous connections, even without using CDNs across multiple hostnames.)
Another advantage to using a CDN is that it generally offers more protection against Distributed Denial of Service (DDoS) attacks than traditional web hosting. DDoS attacks are malicious floods of nuisance requests from many different machines on the Internet, often controlled by a single attacker and aimed at temporarily disrupting a web site or service. Using a CDN makes it harder for the DDoS attack to focus electronically and geographically on a single server. (Mind you, Webnames Hosting packages already come with Enterprise-level DDoS protection as a standard feature.)
Disadvantages of using a CDN
CDNs, while useful, do come with some disadvantages. The first obvious disadvantage is that a CDN will complicate your web application setup. You’ll need to keep track of which of your resources are served locally and which are served by a CDN. Occasionally a CDN will change its URLs or apply other restrictions that you will need to reflect in your HTML source.
Another potential disadvantage is security and control. While the big CDN hosts like cdnjs, Google, and Microsoft probably have more people paid to keep their servers secure than you have in your whole company, they are also big and attractive targets for hackers. If one of the big CDN hosts were compromised, it could have a devastating effect on the security and privacy of millions of web users, including your own. This can be mitigated to some extent using a new HTML feature called Subresource Integrity, but you are still putting a lot of trust in large, faceless corporations that have no obligation toward you.
Who is a CDN for?
If you're building your very first website and are not expecting a lot of visitors, a domain name, a hosting package and an SSL certificate should be good enough to get started, if you know how to build a website. Alternatively you could use a website builder.
A need for a content delivery network on your website does not arise until your traffic starts growing over a few hundred every day or if you have major traffic surges at specific times due to the nature of your website. For instance, a sports fan blog might experience traffic surges during and just after a game for match reports and commentary, while it might be relatively flat at other times.
If you're expecting your website traffic to go up rapidly due to marketing campaigns or other activities, we recommend that you consider using a CDN.
- Improved performance due to geographic distribution and caching
- Potentially lower bandwidth costs
- Potentially enhanced DDOS protection
- Trusting big corporations / loss of control
In summary, using a CDN is a good way to improve the performance and scalability of your web site. It can increase the complexity of your architecture, but the advantages often outweigh the disadvantages.