A content delivery network (CDN) is a collection of servers scattered around the world that deliver parts of your website to site visitors located near those servers.
The most common use of a CDN is to provide images from a website. This is because images are usually the slowest loading part of a web page.
What is a CDN?
A CDN is not a web host. It simply caches the parts of your website that you have set up to be served by a CDN. These saved (cache) files are uploaded to all different 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 some other files from the CDN server closest to their location.
These files can be:
Demand for CDN services skyrocketed when Google started using page load speed as a variable in their ranking algorithm.
This race to become the fastest loading page on a topic required website owners to look for alternatives to slow loading images on the site. The distributed, cached CDN network was the perfect solution.
Why a CDN is essential for your site
If you own a website, the speed at which pages load is important for a number of reasons. As mentioned above, it will increase your overall ranking score with Google.
Second, it improves the experience visitors have on your website. This makes them stay longer on your website and visit more pages on it.
Here are a few other ways a CDN is essential to your website.
By using a CDN, you shift the bandwidth usage from your web host’s server to the distributed network of CDN servers.
Once you’ve set up your CDN account and set it up with your domain, you’ll see that bandwidth start piling up in your account dashboard.
This is the bandwidth query that you remove from your web host’s server. Because web hosting services are so expensive — and often charged for using more bandwidth — cutting bandwidth usage usually equates to significant cost savings.
CDN bandwidth costs are much cheaper than web hosting costs. This is because CDN services set up their server network to manage high-bandwidth content such as images. They do this in the following ways.
- CDNs use optimizations such as server load balancing and stationary disks, which speed up transfers and reduce errors.
- Through file size manipulation techniques, such as file compression and size reduction, CDNs reduce the amount of data transferred.
- By using SSL/TLS certificates, CDNs can reduce the number of fake transfers, eliminating the need to restart a transfer and send even more data.
When it comes to reliability, few things reduce your website downtime more than using a CDN service.
This increased uptime is due to a number of reasons.
The distributed CDN network means that most of your bandwidth – images – comes from multiple servers from 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.
When your website traffic increases significantly, there is a lot of demand from multiple hardware. Specifically, the web server in your web host’s data center and the distributed servers managed by your CDN service.
And since images and files are the bulk of the data being transferred, that’s where most of the demand will take place.
The fact that CDNs manage that demand across multiple load-balanced servers means that your site can handle significantly more traffic than if you weren’t using a CDN service.
You may be surprised to learn that using a CDN can also increase the security of your site.
To understand this, it is first important to understand the flow of data when visitors come to your website.
Picture this as a dam with multiple water ports. In this scenario, it would be a dam with only one port for water to flow through. It wouldn’t take too much water to overload the dam and allow the water to flow over the top.
This is why most dams are built with multiple gates that can be opened if the water level rises on the other side.
If you have a website hosted on a single web server, it will take a lot less effort for a DDOS attacker to take your website down.
DDOS attacks are launched by many different “bots” from around the world, simulating hundreds or even thousands of users making requests against your web server at the same time.
However, by using a CDN service with distributed web servers around the world, all those servers are like extra ports in the dam.
Now your web server only needs to provide text and multiple CDN servers provide images and other files. All of these servers essentially share the demand for bandwidth.
This does not provide 100% protection against DDOS attacks, but it does require that the efforts that the hackers put into the attack are much greater before your website goes down.
In addition, if you ensure that your CDN is set up with TLS/SSL certificates, all traffic is encrypted and protected from hackers intercepting web traffic.
How to set up your CDN service
While a CDN service may sound complicated, setting it up is quite simple.
First you need to choose a CDN service. There are a few important ones to choose from.
- cloudflare: One of the largest and most well-known CDN services used by many large companies around the world.
- Fast: Offers a number of web optimization products, including CDN content delivery.
- keyCDN: Operates 34 data centers worldwide, with proven website speed performance.
- MetaCDN: Unlike other CDN services that charge based on usage, this service charges a flat monthly fee.
- Stacking path: StackPath, formerly MaxCDN, is used by many companies and websites around the world.
Each of these services provides ample CDN optimization for your site. If your site is small, it is better to opt for a usage-based payment model as your bandwidth will likely be low. If you have a large website or business, the flat rate model is better.
After you sign up for a CDN service, you need to set up your CDN zone in your account.
Setting up the account simply involves providing your domain name and configuring caching and compression. Usually it’s fine to leave these settings as default.
Note the CNAME hostname provided by your CDN. You will need this later.
Finally, you need to install a CDN plugin on your site. For example, if you have a WordPress site, W3 total cache is a popular option.
After installing the plugin, you will see a field where you can enter the CNAME of your CDN service.
You will also find a section where you can enable what type of files on your website you want the CDN service to cache and provide to visitors.
After you’ve saved all the changes, you should see the CDN bandwidth graphs start showing visitors over time. It may take some time for the changes to replicate on the Internet, but the DNS changes should update in about 24 hours.
Given the performance and security benefits that a CDN service provides, you can’t afford not to configure it for your website.