A Content Delivery Network (CDN) is a collection of servers distributed around the world that deliver portions of your website to visitors located near those servers.
Most often, a CDN is used to deliver images from a website. This is because images tend to load the slowest on a web page.
What is a CDN?
CDN is not web hosting. It simply caches the parts of your website that you have configured to serve on the CDN. These saved (cached) files are uploaded to all servers around the world.
When a visitor from another country visits your website, they receive the text directly from your web host, but they may receive a number of other files from the CDN server closest to them.
These files may include:
- style sheets
The demand for CDN services skyrocketed when Google started using page load speed as one variable in its ranking algorithm.
This race to become the fastest loading page for a topic has required website owners to find alternatives for the slow loading images on the site. The distributed cached CDN was the perfect solution.
Why CDN is Important to Your Site
If you have a website, page loading speed is important for several reasons. As mentioned above, this will boost your overall Google rankings.
Second, it improves the visitor’s experience of your site. This will make them stay on your site longer and visit more pages on it.
Here are a few more reasons why a CDN is important to your website.
By using a CDN, you are switching bandwidth usage from your web host’s server to a distributed network of CDN servers.
After you set up your CDN account and set it up for your domain, you will see the bandwidth starting to pile up in your account’s dashboard.
It is the need for bandwidth that you are charging from your web host’s server. Since web hosting services are as expensive as they are and are very often charged to use more bandwidth, reducing bandwidth usage usually means significant cost savings.
The cost of CDN bandwidth is much lower than the cost of web hosting. This is because CDN services configure their server network to manage high bandwidth content such as images. They do it in the following ways.
- CDNs use optimizations such as server load balancing and steady state drives to speed up transfers and reduce errors.
- By resizing files. Methods such as file compression and minification, CDNs reduce the amount of data transferred.
- By using SSL / TLS certificates, CDNs can reduce false transmissions, thus avoiding the need to restart transmissions and send even more data.
When it comes to reliability, there are several things that reduce your website’s downtime more than using a CDN service.
There are a number of reasons for this increased uptime.
A distributed CDN means that the bulk of your bandwidth – images – comes from multiple servers around the world. CDN services use a technique called â€œload balancing,â€ which means that when there is excessive demand from one server, other servers are used to balance the load.
Whenever your website traffic increases significantly, there is a great need for multiple hardware. Specifically, the web server in your web host’s datacenter, and the distributed servers managed by your CDN service.
And since images and files represent the largest amount of data transferred, this is where the demand will be greatest.
The fact that CDNs are managing this demand across multiple load-balanced servers means that your site will be able to handle significantly more traffic than if you weren’t using the CDN service.
You might be surprised to learn that using a CDN can also improve the security of your site.
To understand this, it is first important to understand the data flow when visitors arrive at your site.
Imagine a dam with many water ports. In this scenario, it will be a dam with a single port for water flow. It does not take too much water for the dam to overload and the water to flow over its top.
This is why most dams are built with multiple ports that can be opened when the water level rises on the other side.
If you have a website hosted on the same web server, it will take much less effort for an attacker to disable your website.
DDOS attacks are launched by many different “bots” from all over the world, simulating the simultaneous access of hundreds or even thousands of users to your web server.
However, when using a CDN service with distributed web servers around the world, all of these servers are like additional ports in a dam.
Now your webserver only needs text, and multiple CDN servers provide images and other files. All of these servers essentially share the bandwidth demand.
This will not provide 100% protection against DDOS attacks, but it will require hackers to put in much more effort before your site crashes.
Additionally, if you set up your CDN with TLS / SSL certificates, all traffic is encrypted and protected from hackers intercepting web traffic.
How to set up the CDN Service
While the CDN service may seem daunting, setting it up is fairly straightforward.
First, you need to choose a CDN service. You can choose from several basic ones.
- Cloudflare: One of the largest and best known CDN services used by many large enterprises around the world.
- Fast: Offers a range of web optimization products, including CDN content delivery.
- KeyCDN: operates 34 datacenters located around the world with proven website speed ratings.
- MetaCDN: Unlike other CDNs. Services that charge you based on usage, this service charges a flat monthly fee.
- StackPath: Formerly MaxCDN, StackPath is used by many companies and websites around the world.
Any of these services will provide sufficient CDN optimization for your site. If your site is small, it is better to use a usage-based payment model as you will have low bandwidth. If you have a large website or business, a flat rate model is better.
Once you have subscribed to the CDN service, you will need to set up a CDN zone in your account.
To set up an account, you just need to specify your domain name, as well as configure caching and compression. Generally, you can leave these settings at their default.
Take note of the CNAME hostname provided by your CDN. You will need this later.
Finally, you will need to install the CDN plugin on your site. For example, if you are using a WordPress site, W3 Total Cache would be a popular option.
After installing the plugin, you will see an available field where you can enter the CNAME provided by your CDN service.
You will also find a section where you can specify what types of files on your website you want the CDN service to cache and serve to visitors.
After you’ve saved all your changes, you should see the CDN throughput graphs begin to reflect visitors over time. Perhaps after some time the changes will be replicated across the internet, but the DNS changes should be updated in about 24 hours.
Given the performance and security benefits of a CDN service, you can’t afford not to customize it for your website.