All modern browsers allow users to download up to six resources concurrently per domain when a person views a website. This means that if the webpage contains 100 images, 10 CSS files, and 10 javascript files, it would take 20 trips to a single domain to download all that content. If the browser was to download those 120 resources across 20 different domains, it would only take one trip to get all the content and the page would load that much faster. However, the webpage in this example would now be dependent on 20 domains to be working correctly all the time. These are the key advantages and disadvantages of a content delivery network.
The main advantages of using a content delivery network are:
- Lower server load.
- Increase in concurrent users on server.
- Geo-location of the content.
- Faster content delivery to the web browsers.
- Customer may have already downloaded the content
The main disadvantages of using a content delivery network are:
- Content delivery networks cost additional money.
- Adds complexity to your website and deployment procedures.
- Customers may have network filters that block some Content delivery networks and prevent your content from being loaded.
- Geo-location may not be close to your target audience, in fact, it might be further than your own website losing any benefit speed.
Advantages of a Content Delivery Network
Lower server load and more concurrent users on the server
If there are less resources being downloaded from the server to show a customer a webpage, then the server can load more websites for customers at the same time. For example, if the server used to have to show the HTML content and 100 images each time the home page was requested, but a CDN now hosts the images. The server will only need to show the HTML each time, so it can handle 100 more requests (These numbers are not exact, but for illustrative purposes).
Faster delivery of content and geo-location of the content
Usually a small to medium sized business will host their website on one domain with one web hosting provider, like the web hosting provided by Webnames.ca. If this business was to use content delivery networks, they would be able to deliver content like javascript or css faster to customer located in other parts of the world. However, their main site content would still be provided by the web hosting company, like Webnames.ca
Customer already has the content
If the company uses a popular content delivery network for a common javascript library, the customer may have already downloaded the library from before and it will not need to get the content again. Webnames.ca uses content delivery networks at Google for some of the common javascript libraries used on the internet like jQuery.
Disadvantages of a Content Delivery Network
Additional Costs per Month for Content Delivery Networks
There are a few free content delivery networks available like GoogleAPI, BootstrapCDN, CloudFlare, Coral Content Distribution Network, and Incapsula. However, most CDNs are paid for monthly based on the number of requests they get for resources. The cost of this depends on the amount of visitors and resources you have on your website. However, this can cost a lot over time in additional to the monthly hosting plan.
Adds Complexity and Content Delivery Network (CDN) may be blocked
Your website will not all be dependent on a single web hosting company like Webnames.ca, but instead, it will be dependent on the web hosting company and any CDNs you have setup for your resources. If for some reason your content delivery network fails to load the resource, your site might look broken because the javascript file your site is dependent on is missing. If you had all your content located at Webnames.ca, your website would load 100% the way it should.
Also, if your content delivery network company (CDN) is blocked by your customer’s network (due to spamming or other issues), your website might look broken for only a few customers, which makes it harder to diagnose.
Geo-location may not help, but be worse
A lot of content delivery network companies have servers all around the world, but they may not have servers in your country. If this was the case, you may find that those resources take longer for the page to render, than if you had all the resources on your server instead.
Conclusion about a Content Delivery Network
In general, the advantages of a content delivery network outweigh the disadvantages. However, it really comes down to just trying it out for yourself.
For a complete list of commercial and free content delivery networks (CDN), please read the Wikipedia article about content delivery networks.