How to configure a CDN?

We all know that in this day and age, you don’t need to be a computer expert to run a website, but it nevertheless pays to have a basic understanding of how the vast network of computers and servers that we call the internet works. What happens, for example, when a user enters the URL of your website into the address bar and hits Enter?

Table of Contents

  • What is a CDN? And why should I care?
  • The benefits of using a CDN
  • Is there a bandwidth limit?
  • Can I use it with multiple websites?
  • Do all hosting platforms support and benefit from a good CDN?
  • What CDN services should I use?
  • How much does it cost?
  • How to configure a CDN with ScalaHosting?
  • Testing
  • Final takes

Traditionally, the user’s computer would fire off a request that would embark on a bit of a journey. It needs to pass through a number of routers and network switches in order to reach the server hosting your website. We’re talking about physical devices spread across different countries and continents. The higher the number of devices it needs to go through, the longer it will take to reach your server. This is far from the end of the story, though.

When the server receives the request, it must process it and send a response in the form of the web pages media and image files. All that data needs to travel back to the user, passing through the same routers and switches as the request.

The information covers thousands of miles in mere seconds, but even so, you can probably see that this is far from an ideal setup, especially if you’re trying to reach a global audience. This is why Content Delivery Networks (CDNs) exist.

 

What is a CDN? And why should I care?

The physical distance between the end user and the server hosting the content plays a major role in the website’s performance. The internet is a global phenomenon, though, and ensuring that all users are geographically close to the web pages they’re trying to access is extremely difficult. It’s not impossible, though.

A Content Delivery Network (also known as Content Distribution Network or simply CDN) is a network of servers and data centers spread all around the world that store website data. A CDN isn’t s substitute for a web host. Instead, it’s a way of ensuring that your website’s static content is stored in multiple locations all around the world and is loaded from the server that is closest to the user.

Here’s a simple scenario that will show you how a CDN works. You host a website in the US, and a user from Germany is trying to reach it. Normally, all the data packets would need to travel between Germany and the US if the website is to load. If you have a CDN turned on, however, CSS files, JavaScript libraries, and images would be stored on multiple locations all around the world, including on a server close to the user in Germany.

When they try to access the website, the static data will be loaded from the CDN server (also known as an edge server) closest to their geographical location. Your web host server (or origin server) will only be responsible for handling the dynamic parts of your website. What are the benefits of all this?

The amount of information that needs to make the journey between the US and Germany is smaller, and as a result, the website loads much quicker.

 

The benefits of using CDN

Internet users aren’t renowned for their patience. If your website doesn’t load quickly, it will have a high bounce rate, and the effects on your business could be appalling. The performance benefit can be remarkable, but is it the only advantage to using a CDN?

Effectively, some of your website’s files will be stored on multiple servers, and this might not seem like a very good idea at first. Some of you might think that this will make managing the website more complicated. You might also think that the higher the number of servers, the greater the possibility of a hardware failure and downtime.

We can safely say that these fears are unfounded. One of the great things about a content delivery network is that setting it up for your website is an almost entirely automated process. In most cases, after you change your domain’s nameservers, the CDN provider does the rest of the work. And even if one of the edge servers fail for some reason, there are plenty of others to take up the slack and prevent downtime.

Meanwhile, the fact that the content is cached and served from multiple different locations reduces the load on your origin server and decreases the chances of reaching your bandwidth limit. There are clear security benefits, as well.

CDN providers are usually big organizations that know how to set up and configure their servers, which means that you don’t really need to worry about data loss. Distributed Denial of Service (DDoS) attacks are less likely to bring your website down as well because properly configured CDNs effectively hide the IP address of the origin server. Instead of flooding the web host with junk requests, the attackers will be hitting the edge servers that can block the malicious traffic and protect your website.

 

Is there a bandwidth limit?

Some of the bandwidth that would normally be taken up by your web host will be handled by the CDN provider, and you might be wondering whether this will cost you anything. Different providers have different terms of service, and there is no single answer to this question. 

Some will track the amount of bandwidth you’re using up and will charge you accordingly. Others will give you a monthly quota and will charge you extra money if you exceed it. If you go for the CDN service offered by Cloudflare and integrated into your ScalaHosting account, however, you’ll get all the bandwidth you need for a regular online project at no extra cost.

 

Can I use it with multiple websites?

As you can see, there are plenty of advantages to using a CDN, and if you have multiple projects running at the same time, you might be wondering whether it’s suitable for all of them. The short answer is yes.

A CDN can be used to improve the performance and security of any website, though it must be said that for some, the benefits will be much more visible. Websites that have a lot of images, video, and audio assets, for example, are perfect candidates. Media files tend to be larger in size, and transferring them across vast distances can be a slow process. Processing them also tends to take up a lot of resources, and your CDN provider’s edge servers are much better set up to deal with this load.

A content delivery network is also perfect for websites that attract users from all over the world. CDN providers distribute the content across hundreds of servers across the globe, meaning that users will always be close to the website’s files.

Do all hosting platforms support and benefit from a good CDN?

As we mentioned already, the benefits you’re likely to see as a result of an enabled content delivery network depend mostly on the type of website you’re running. The main web host you use is also a factor, though.

Shared hosting users are the ones who benefit the most from a content delivery network. The resources in a shared hosting scenario are limited , and users need all the help they can get. A CDN can do some of the heavy lifting for websites prone to traffic spikes as well, though it can’t perform miracles for highs that are too big and too frequent.

When it comes to cloud hosting, the advantages are slightly less obvious. In general, websites that use cloud hosting solutions are less vulnerable to DDoS attacks, and some might argue that the extra security provided by CDNs is lost in that respect. What’s more, some cloud clusters are spread all around the world and bring additional speed and reliability out-of-the-box. Nevertheless, a highly optimized CDN can still help with the performance and make your hosting more cost-efficient.

 

What CDN services should I use?

The first example of a content delivery network was created back in the late-1990s, but it wasn’t until relatively recently that CDN providers started offering their service to regular website owners. Despite this, there are now so many of them that choosing the right one might be a tall order.

The number of providers is huge, and as if that wasn’t enough, before you make your choice, you need to think about the requirements of your project and the features you’re going to need. We believe, however, that the services Cloudflare offers should suit most of our customers’ needs.

Launched in 2010, Cloudflare is now one of the biggest and most popular CDN service providers. It has managed to deploy servers in more than 190 cities across 90 countries, and it adds new locations frequently. The years of experience helps it configure and optimize the equipment for the best possible speed, reliability, and security, and after you sign up, it will automatically cache your website’s static files without the need for any actions on your side.

 

How much does it cost?

Most CDN providers offer their services on either a subscription or a pay-as-you-go basis. Because Cloudflare is such a big name in the industry and because it provides a range of other services, it has a plan that lets website owners use its content delivery network completely free of charge.

 

How to configure a CDN with ScalaHosting?

Turning on Cloudflare’s free content delivery network service is as easy as registering your domain name and changing its DNS settings so that it points to the CDN. You can do that either by going to Cloudflare’s own website or via the Cloudflare panel in your Client Area.

Cloudflare will tell you which nameservers you need to point your domain to, and once you’ve done it, you simply need to leave it some time so that the changes propagate throughout the web. Cloudflare will automatically cache the static contents of your website and will start serving it from the location nearest to the user. If you feel that your website needs anything more, you can also check out the additional features Cloudflare offers with its paid plans.

 

Testing

How much the loading times improve will be dependent on the nature of your website, but the effects are likely to be immediately visible. If you want to be sure, however, you can always do a before-and-after test on one of the numerous online services that measure websites’ speed and performance. They can also tell you whether your website uses a CDN, and if it doesn’t, they will advise turning it on.

 

Final takes

Hosting a website in the 21st century is all about streamlining and optimizing. Users click away from websites that take a lot of time to load, and if you don’t do everything you can to ensure that the performance is top-notch, you’re putting your entire online project at risk. A content delivery network is one of the simpler steps you can take in order to improve your website’s loading speeds.

Write a Comment

Required*