Basic Concepts of CDN (Content Delivery Network)

Now, there are some great benefits to a Content Delivery Network. You’re going to have a faster-running website, you’re going to have a more secure website, and you’re going to have lower bandwidth consumption. Essentially, because you’re not loading everything on your server, you’re simply serving up the static assets, and you don’t have all of this bandwidth that’s running on that main server.

CDN.jpg


To further optimize the performance of your site, you can and should use a Content Delivery Network.

What is CDN and How Does it Work?​

Unlike traditional web hosting where content is hosted on a single server, CDNs cache the content on your site and distribute them across servers all over the world.

Often this will be thousands of servers located all over the world. This means as requests are made for the content, the network can share the load and serve content based on the closest location. This means that the delivery of the content makes it easier for sites to manage heavy traffic or spikes in requests.

CDNs are used largely to serve static resources like CSS and JavaScript libraries, as well as media files like images and video. Entire websites can be served through them, but it’s more common to find sites all floating specific types of content through CDNs. For example, if your site uses the popular jQuery JavaScript library, you could certainly host it yourself, but that would mean that every visitor to your site will have to request and download it from your server. However, if you used the following line of code, you can offload this request to Google’s Content Delivery Network of hosted JavaScript libraries.

Then, when someone visits your sites, they’re visiting the servers from the CDN, not your server, and pulling content from the CDN servers into their computer. This dramatically improves performance because the CDN servers are likely to be closer to the user, are likely to be more powerful, and are likely to have much bigger bandwidth than what you have on your server.

Content Delivery Networks often referred to as CDNs, are a way of delivering content online over a distributed network of servers. This is usually geographically diverse to provide local access to users all over the world.

There are many reasons to use CDN but the most common reasons are as follows:

Without a CDN, when a visitor goes through your site they’re requesting data directly from your server and your server will send that data up through whatever connection it has to the visitor. There are some obvious issues with this. First of all, the distance between the server and the visitor has a huge role to play in performance. If the visitor is in Eastern Europe and your server is in the United States, then every piece of data has to travel across the Atlantic to get to the visitor, and that will just take a lot of time. Secondly, if there are a lot of visitors to your server, your server will have a hard time providing the files because it needs to use a lot of resources.

It will also have a bandwidth limit, how much data can be pushed through the network at once, and the more visitors you get, the more likely it is for your site to either slow down or break down completely. If you’re using a shared host, you also have to consider the other traffic on the network. You would typically be in a server with many other sites and if one of the other sites is very popular then your site will slow down. And finally, you have your server performance. If you are using a cheap service provider, then your server will probably be cheap and it won’t perform very well, especially under a lot of loads.

When we use a CDN all of this changes completely. Your server is only there to serve content to the CDN and the visitor gets their content directly from the CDN. That means the load on your server dramatically decreases and the CDN takes over the heavy lifting of feeding all the static content to the visitor.

In addition, there’s also the issue of malicious attacks. If you set up a server on the web, there’s a good likelihood that at some point, someone will try to find out if your server is vulnerable and they’ll try to send out spam to it or hack into it or attack it with what’s known as a denial of service attack, where they just get a ton of computers to ping your server all at once to take it off the internet. With a single server, this is hard to protect against and the typical result of one of these attacks is your service provider will discontinue your service and take your site off the internet.

CDNs typically have solid security features in place, so if someone tries to maliciously attack your site, they’re not getting to your server, they’re trying to attack the CDN itself and the CDN will have a firewall and other measures in place to prevent those attacks from actually hitting the files themselves.

This will protect both your server, your data, and the visitors that are coming to your site. So, in effect, using a CDN, you’re offloading the responsibility of your data to a much larger network of computers that’s far more suited to serve that data to the visitors. And of course, there is the global reach factor. If you have a server anywhere, there is a chance that you have visitors from somewhere else on the globe. CDNs were created to serve up data from large providers like TV. networks or very, very popular sites, and they were created because these sites were having trouble serving all this data across the entire planet.

Now, everyone can take advantage of this same technology and it’s not very expensive the result is, that your site doesn’t just live on the origin server, it lives everywhere in the world and any update on your origin servers gets pushed out to all the servers across the world.

Now that I got you interested in using a CDN, I, unfortunately, can’t tell you which one to use. That’s because there are so many different options and they all provide slightly different features. Instead, I’ll tell you how to pick the right one. If you want a solid CDN, here’s a good checklist to follow:

First of all, it must support HTTPS and HTTP/2 with all the features, including server push.

Not every CDN supports HTTPS and not every CDN that supports HTTP/2 also supports server push. So make sure this is a CDN that provides all the latest features, otherwise, you won’t get the benefit of all the stuff we’ve been talking about so far in the course.

Second, ask the CDN about their global reach and find out where their servers are. Some CDNs only have servers in the United States or North America, while others have servers all over the world. And it’s important to match your CDN choice with the audience you have.

If your audience is primarily in North America, then you can go with a CDN with servers only here. If your audience is worldwide, then you have to make sure you have proper coverage. Also, ask about security features. Most CDNs will provide a firewall and some DDoS protection, but it’s a good idea to check what you are getting before you buy it because the better protection you can get, the better your site is protected and the better your visitors are protected. Of course, the cost is a factor. The good news is, that most CDNs provide fairly cheap solutions now, you can get it from down to 10 to 20 dollars a month, but this all depends on the type of traffic you have, the type of security features you need, and how big your site is.

So, check the cost of a few different options and find one that fits within your budget. Finally, take the CDN for a spin to see how easy it is to use. Different CDNs target different markets, so some are more enterprise-focused and quite complex, but give you a lot of detail control, while others are more consumer-focused and very simple, but give you very little control. So, here it’s important to pick a CDN that fits with your specific usage scenario for each site you’re working with. Now, here’s a caveat. Most hosting companies will claim to have CDNs, but they’re just a bunch of large servers that they’re distributing your content over.

To get the full benefit out of CDN, you need to use a third-party CDN that only provides CDN services and nothing else. It will greatly impact your performance and it will probably also save you a lot of money in hosting costs. To that end, most hosting companies have CDN providers they collaborate with for one-click installs or few-click installs. If this is an option, check out how much money you’ll save by using that bundled option because usually, they come with a deal, and also check out if any limitations or any weird funkiness are going on in the setup to make sure you’re getting the service you want and need.

Finally, and this is important, use a for-pay provider. There are free options for CDNs out there, but they are all suboptimal. In particular, most free options do not give you HTTPS support, which means you won’t have HTTP/2. To get the full benefit out of a CDN, you need to pay for it and you should pay for it, so make sure CDNs are part of your overall budget for the site.

Is CDN good for every website?​

CDNs aren’t right for every site, however. Using one adds a layer of complexity to your site that a small site or site with low traffic might not need. Often, instead of using an entire framework or a library, it’s better to use a minified version with only the parts that you need. Such customization is usually not available through CDNs that host those libraries. It’s especially important to consider a site’s security needs before using a CDN.

For sites where you need complete ownership and control over the site’s content, a CDN probably isn’t the best choice. CDNs are an important option to consider when deciding how content from your site should be served. In many cases, it makes sense to take advantage of the performance gains they offer as well as the reduced bandwidth to your host.
 
Last edited:

About us

  • oDiscuss Community provides a forum platform for discussing, sharing resources and ideas, and finding answers on various topics, including technology, IT, IT systems, networking systems, computers, servers, blogging, digital marketing, SEO, web design, web development, and more.

Quick Navigation

User Menu