Content delivery networks
A content delivery network (CDN) places files in different locations so that the person using your webpage can receive the nearest copy of it faster.
If you are considering a CDN this page will help you out by showing the steps required and defining the terms used (which can be confusing). No matter what content delivery company you are thinking of using this page will give you a more in-depth look at CDNs in general so you can make an informed decision.
What is a CDN?
A CDN (content delivery network) is a network of servers located in different parts of a country (or the globe) that stores files to be used by your website visitors.
The reason they exist is because there is a measurable amount of latency (waiting time) for a website user who is visiting a page that is hosted thousands of miles away. There are also routing issues that can occur when a user is seeing such a webpage. If someone in New York is using a webpage that is hosted in Los Angeles they are seeing a slower version of that webpage because of the above mentioned routing issues and sheer distance the files have to travel.
By having your files on several servers across a geographical area you can make sure the user is loading files that are near them, not all the way across the country or ocean.
Does your site need a CDN?
Content delivery networks are part of an overall website strategy, but they are not a first step to take when improving your site. It is important to ensure you are doing all the things you can do before taking on the cost and complication of a content delivery network.
I would honestly say that there is a set of priorities for most websites:
- Make your site amazing for your users
- Improve the pagespeed of your site
- Make your site mobile friendly
- Decide on if a CDN can further help
Some types of sites will almost always benefit from a CDN:
- Sites streaming large video files
- Sites which consist of mainly large media files like image sites
- Sites which have known heavy traffic in different countries
Some sites almost never need a CDN:
- Local business sites (restaurants, beauty parlors, etc.)
- Sites that have their main traffic in one geographic area or region
Why are CDNs becoming so popular?
The real reason that so many businesses and webmasters are now using CDNs is because Google has started using pagespeed as a ranking factor. Content delivery networks however provide a faster experience for users, and that means happier users who buy more things and click more ads. An additional reason for CDN use is the explosion of tablet and mobile users who depend on speed more so than desktop users who have stabler internet connections.
CDNs are becoming a defacto part of a webmasters toolkit, and even if you don’t get one now you will probably have to do so later.
How much do they cost?
Just like virtually every web service offered, there are all levels of costs for content delivery networks from free to thousands of dollars.
Best CDN for WordPress 2021
Some of the more known and reputable CDN services for WordPress (2021):
- Cloudflare (has free option)
- Amazon CloudFront
- Bunny CDN
How hard are they to setup?
Any content delivery network you use requires some steps that can be frustrating. It isn’t a 5 minute thing (even if they say it is). I would dedicate a couple hours specifically to set yourself up and get things going. The time will be spent learning new terminology, checking things, and making sure your content is set up right.
Do I need a CDN if my customers are only in one country?
The quick answer is yes, especially if you are in a large country like the United States. The longer answer is that if your country is very small, and you are sure you only need to communicate with people in your country, then you might not need one. America is a good example of a large country where CDNs offer qualitative improvements to page speed, Liechtenstein (a country with only 70 square miles) is an example of a small country.
How do you set a CDN up?
The main steps for setting up a CDN are
- Signing up for a service
- Know what files you are using
- Getting your files to the CDN servers
- Decide on how to name your urls (CNAME)
- Ensuring your webpages are calling (using) the files you sent to the CDN
Know what files you are using
Getting your files to the CDN servers
This simple sounding step isn’t always so simple, with any CDN, you will need to get the files you want to serve to the CDN web servers. Some places will have options to do it for you almost automatically, some won’t.
Many have automatic setups if you are using WordPress or other common CMSs (content management systems).
The basic premise however is the same across all CDNs. You will need to have your files hosted by the network and this is usually a one step process of loading those files somewhere once and the content delivery network will then replicate those files across their network.
Decide how to name your urls (CNAME)
Once your files are on the CDN servers they will have a different url than they once did. Let’s take an CSS fill as an example. Your old CSS file was at “example.com/css/main.css” , well now that you are using a CDN your CSS file is located at a url that may look as ugly as this “dfg233445577449dhhty74/main.css” but don’t panic!
You can use such urls for web assets, but it sure doesn’t seem very nice does it? Instead we can choose to use a name of our own choosing (the most common being “cdn.example.com”) and then use something called CNAME to make sure it looks correct and nice to our users. This is a simple step that will result in our CSS file coming from “cdn.example.com/main.css” which is a whole lot better.
Ensuring your webpages are calling the right files
This complicated sounding step is actually very easy if your are using WordPress or another common CMS. You can basically just tell your CMS to swap out the files automatically using common caching systems. An example for WordPress would be to use W3 TOTAL CACHE. Any blog should be using a caching system already and if your isn’t then your blog is probably slow. Using caching properly is an important step in improving pagespeed and will offer massive benefits to your users. In our case, it will also help us to automatically use our CDN files.
Most CDNs will have a page or dashboard where you can see the usage of your files. Other ways of testing would be to use webpagetest.org and test your site from different locations.
What about SEO?
When you start hearing about file name changes it is going to scare you and make you worry about your SEO (search engine optimization). I hear you. The truth however is that reputable CDNs have good solutions for any common SEO problems.
This sounds complicated!
I admit it does sound complicated, but it is very similar to when you first worked with a webhost. It was probably a bit confusing when you first did it, because it was new to you, but now you know how to log in to your host, change file names, etc. with no problem. Much like a new host, a CDN does require some learning when setting it up, but the good news is that once it is setup there won’t be anything else you will really be doing with it. The initial setup is the main task. If this still sounds too complicated make sure to use a CDN that helps you do it.