Nowadays it’s relatively inexpensive to use a Content Distribution Network (CDN) for your WordPress website, some are even free. While there are many benefits of using a CDN, they should be taken with a grain of salt.
In this article you won’t find only hallelujahs for using a CDN, but I will give you 5 good reasons why you should be using a CDN with WordPress.
One important note: Even if you’re saying you are not using a CDN, you probably are. Almost all of the third party apps running on your site, like Facebook or Google Analytics are using CDNs to load their scripts. Craig gives further insight in his article about CDNs.
In this article I will focus on the CDN you actively turn on yourself however, which is quite easy if you use a WordPress caching plugin.
Let’s start with what most people consider the main selling point of a CDN: Speed. It is widely believed that using a CDN will increase the loading speed of your site.
While in many cases this is true, what you really should look at is the speed improvement. Going from 15 seconds to 6 seconds loading time after switching on a CDN might seem impressive, but still about 4 seconds longer than needed. It basically tells you your code sucks, even though some of your files are loading faster.
Going from 6 to 2 seconds however is a great improvement, and if it can be fully attributed to the CDN then it’s a useful addition. In this case your site is probably well optimized, and you need the CDN to speed up loading your heavier or large number of files.
What’s also very important is the capabilities and configuration of your web host. More often than not, a premium web host already has an internal CDN-like setup, where they serve up your static files from optimized file servers.
For example I am using a WordPress specialized host for one of my personal sites in the UK, where they have one of their data centers based in London. These guys have optimization running through their veins and it shows in the results I see. This is a good case of paying extra for a higher quality service.
The above tests were performed at GTMetrix.com. The homepage has quite a lot or photos on it, which makes it in theory, ideal for a CDN. The site and images are fairly optimized though, and turning on a CDN gave a load time improvement of about… 0.3 seconds. Yep, that’s what you get for spending a bit more on hosting.
Lesson learned here: Make sure you actually need a CDN.
2. Load Reduction and Consistent Speed
Another main reason for using a CDN is for load reduction and the resulting consistent speed it gives you, especially when traffic spikes. When running your own server or using shared hosting, you might notice things slow down during these times. A CDN can help you to reduce or even prevent this effect.
Because CDNs are designed to handle massive loads of traffic, they won’t break when you suddenly become very popular. We used to call this the Slashdot-effect, and later the Digg-effect, back in the days. This was because becoming popular on these social platforms typically brought your average shared hosting account to its knees.
As with speed, using a CDN alone won’t always prevent downtime during traffic surges. If your main site/server is still required for loading dynamic files, it may still go down. Caching is the key here. Once you’ve enabled caching, then you can add a CDN. Always perform real load testing to make sure you’ve got it working correctly.
3. Going Global
The situation where you definitely should be using a CDN is when you want to reach a global audience. A decent CDN provider has servers spread out all over the globe, so there’s always one within a relatively small distance from where you’re connected to the Internet. This means even visitors in a country far, far away can experience your site as if they were sitting next to it.
Of course, this still depends on the coverage of your CDN provider. I have one site with a surprisingly large amount of visitors from India. You would expect a benefit from using a CDN here. Well there is, but it doesn’t help that the files need to come all the way from Singapore, which is the closest location. It’s still closer than the UK, but quite a long way if you have to walk it. So make sure you check the coverage map of a provider first, taking into consideration that Point of Presence alone doesn’t always guarantee complete local coverage.
Various page speed tools support testing from various geographic regions. So if you’re in the UK and your visitors are in the US, run your tests from the US.
4. Cost Savings
Adding a CDN sounds expensive, so how can using a CDN actually save you money? Load reduction is a big one, especially when running your own servers. Using a CDN is, in most cases cheaper than adding more CPU or RAM. The same applies to shared hosting, there may not be a need to upgrade to a higher plan if you reduce your resource usage.
Geo-distribution is another money saver. You could set up web servers in different data centers around the world, but utilizing a CDN is way cheaper.
There’s even a way to get a quality CDN for free, you can use CloudFlare. I’ve written about CloudFlare before and also covered a service called Incapsula. They offer a free CDN too, but focus more on security.
CloudFlare is basically an advanced CDN. You have all the benefits of a regular CDN like optimized servers, parallel downloading (since you’re using a different domain for your CDN) and DDoS protection.
Apart from their core features, CloudFlare also adds their own special sauce, which they use to optimize your images and CSS/scripts (minification). There’s even an option to load your scripts asynchronously. The cost of all this juiciness? $0. You can literally save hundreds of GBs without spending a cent. Their coverage is quite good as well.
5. WordPress Loves CDNs
It’s very easy to integrate a CDN with WordPress, due to it’s simple file structure.
There are many CDN plugins available at the WordPress Directory, and most providers offer their own plugin as well.
Alternatively you can use one of the popular WordPress caching plugins, which not only gives you easy CDN integration but also provides other optimization features for your site.
As you can see there are many great reasons for using a CDN for your WordPress site. There are hardly any downsides of using one.
Always remember to check the coverage of the provider you intend to use. Also make sure you actually need a CDN, and never rely on it solely to speed up your site. Keep that in mind and your site should be loading in lightning fast times.
The Principles of Beautiful Web Design, 4th Edition
Learn PHP in One Day and Learn It Well
Docker for Web Developers