Welcome to the WP Mayor Guide to WordPress Content Delivery Networks. I’ve written this guide keeping the absolute beginner in mind. I shall discuss the basic working principle of a Content Delivery Network and talk about its many advantages. At the end of the guide I’ve shed some light on how a managed WordPress hosting is beneficial to your website. Here’s a quick index to help you navigate:
- What’s a CDN?
- How does it work?
- The advantages of using a CDN
- The very best CDN services for WordPress
- Free CDNs that work like a charm
- Integrating CDN in Managed WordPress hosting
Let’s get started!
What is a CDN?
A Content Delivery Network (CDN) is distributed network of servers strategically located across the globe, housed in various data centres. The goal of a CDN is to serve or transfer data requested by another server (which is usually an end-user like you and me) – with high availability and performance. When an end-user requests data, the job of the CDN is to serve it from a server which is geographically closet to the requestor’s location. There are a handful of free CDN that work flawlessly – I’ve discussed them later on in this guide. Most commercial CDN services employ two pricing models:
- Fixed amount of bandwidth per month – the higher the amount, lower the price per GB.
- ‘Pay as you go’ model which is intended for lower traffic web sites.
- It’s worthwhile to note that the price of a CDN also depends on the requestor’s location. Data transferred to the Asia-Pacific region is usually more expensive compared to data transfer to European and North American countries.
Type of Data Transferred:
I’ve mentioned that a CDN serves static data. What exactly is static data? Glad you asked! Static data includes downloadable content like images, videos, audio clips, archives, etc. Apart from that, the CDN can also host a multitude of other data content such as:
- Live Streaming Media: These include video on demand (VOD) services of different forms.
How does a CDN work?
We now understand that a CDN has multiple servers located across the globe. To understand how a CDN works, let us consider a website – your blog for example. The first thing you do in order to integrate a CDN, is upload all the static files of your website – downloadable stuff, CSS & JS files, images, etc. – to the CDN using their control panel. In WordPress, you don’t have deal with which files to upload – WordPress (with the help of a plugin) does it for you. You can also add a CNAME records to your domain from your domain’s control panel or cPanel for a more professional look – but that’s optional.
Once you’ve uploaded the files, the CDN makes copies of them in all its servers (which can range from less than a hundred to over a thousand). When an end-user visits your site, the CDN network quickly determines which server in its network is closest to the end user and serves the static data from that server. Thus, the data is served at a very high speed (performance) resulting in lower response time.
Perks of using a Content Delivery Network:
Now that you know the underlying principle, let’s take a quick look at some the enormous advantages of using a CDN:
- Higher PageRank: Your site’s speed increases and Google loves speedy sites. Remember those 200+ factors Google uses to rate your site? Neither do I, but speed is one of them – and an important one too.
- Improved UX: A faster site equals lower load time, which paves way to a better user experience (UX). Nobody likes a slow site when the average Internet speed in the technologically sound regions is well over 1 Mbps!
Better Security:As mentioned earlier, the CDN makes copies of your website’s static data in all its servers. Any malicious attempts (except MySQL database injections) would be fruitless!As Tim Nash points out, this is completely wrong. There are 100s of other ways in which your site is vulnerable. So at best, a CDN improves security by redundancy. Please read Tim’s comment for a better explanation.
- Cost Saving: When you use a CDN, the majority of the bandwidth of your hosting server is saved, since the static files are served from the CDN network. I’m not talking about the shared hosts that provide unlimited bandwidth, but the ones with serious firepower like Virtual Private Servers (VPS) or dedicated servers. Bandwidth is expensive when it comes to private servers and that’s where the CDN comes in handy. You end up saving money and a blazing fast website!
WordPress CDN Benchmarks – Before & After using MaxCDN
Seeing is believing. And that is why we’ve complied a list of benchmarks to give you first hand experience of the “before and after effect” of a CDN. We used three tools to benchmark a demo/experimental site – GTmetrix, Pingdom and WebPageTest.
Details about the test site:
- WordPress Version: 3.8.1
- Theme: Echolake by Elegant Themes
- CDN provider: MaxCDN
- Plugin: W3 Total Cache
- Host: Shared host
- Web Server: LiteSpeed
- Caching Enabled: True for results in the second set, i.e. with CDN enabled
NOTE: We’ve conducted the first test without using any form of caching enabled. In the second set, we’ve used W3 Total Cache to implement caching and the CDN. If you want a clearer, unbiased picture, please use the Mark Jaquith’s WP-Stack CDN plugin to conduct the tests. You’ll have to manually install the plugin, since it’s not available in the WordPress plugin repository. Again, thanks to Tim for pointing this out.
GTmetrix provides an excellent tool for comparison and has shown the highest difference with MaxCDN enabled. Following are snapshots of the scores, please click on each image to visit the site for detailed information.
WebPageTest is a renowned webpage benchmark tool. We haven’t quite compressed the experimental site’s images, so you’ll find that the scores are affected by it. Regardless, the benefits of using a CDN are clearly visible. I suggest that you follow each link for detailed results.
Last but certainly not the least, Pingdom is the most popular tool when it comes to web page tests. We’ve selected New York as the test location for both cases to bring you the most accurate results:
We also ran another set of benchmarks with the test server located in Amsterdam, Netherlands. This is what we found:
This gives us a difference of 1.90 seconds – the site when powered by MaxCDN loads 1.09 seconds faster than the site without MaxCDN, as compared to the minor 0.8 seconds difference recorded when the test server was in New York.
The reason – physical distance. New York and Quebec are 844 miles apart whereas Amsterdam and Quebec are 3,115 miles apart. A difference of 2271 miles between the two test locations, accounts for the benchmark differences. If this be the case, imagine what kind of a difference it would make for visitors from Asia?
You might think there isn’t quite a difference in the site’s performance in the Pingdom trials. This is where the problem of a shared host lies. The server load is extremely variable which is why, testing at different times would yield different results – even with the benchmark parameters (i.e. the state of the site) remaining constant. Had we tested this on a VPS or a dedicated server, the results would have been much more distinctive.
The Best CDN Services for WordPress
Now that you know the details of a CDN, let’s take a look at some of the best CDN providers for WordPress.
Stating with the industry leader – MaxCDN is usually the first name that comes to mind when talking about WordPress CDN. In December 2013, they merged with their parent company NetDNA and now provide two CDN solutions – standard and enterprise. MaxCDN’s enterprise solution is used by giants like GitHub, BuySellAds and other high traffic websites.
CloudFront is one of the oldest CDN providers – with and gigantic network. Insanely high traffic websites like Amazon.com, IMDb and 9GAG – all use Amazon CloudFront. Their pricing strategy is based on the requestor’s location and traffic demand. Bandwidth is usually cheaper when the data transfer is within the North America and Europe. They have a Monthly Bandwidth Calculator which helps you estimate a bandwidth amount for their ‘pay as you go’ pricing model. Did you know that you can try out the full CDN experience for free, thanks to Amazon Cloudfront’s free usage quota? All you need is a credit card to get started. Your card won’t be charged if you remain within the free limit.
Other notable CDN services include Fastly, CloudFlare, RackSpace Cloud Files, CacheFly, CDN77 and CDN.net.
Free CDNs for WordPress
If you’re looking for a free CDN service that really does have an effect on speeding up your site, you could try the following:
Photon by Jetpack
Jetpack is one of the most popular and super-useful WordPress plugins offers a plethora of useful modules one of which is called Photon – a free integrated CDN service for any self-hosted WordPress site. All your site’s images are uploaded and served from Automattic’s own network which is powered by EdgeCast.
Download Jetpack for WordPress
Best known for its free CDN service, CloudFlare also offers inbound traffic filtering and malware protection to enhance your website’s security. The paid version of CloudFlare has a lot more to offer including premium CDN, DDoS protection and enhanced malware protection and custom analytics.
Holding it Together
Some of us who aren’t quite experienced or rather familiar with integrating CDNs – manipulating CNAME records, creating new pull zones and a whole lot of other technical issues – can get a bit stressful, even intimidating a times. If you’re one of those folks who want their site to be managed by professionals, then we would highly suggest an alternative – managed WordPress hosting.
The beauty lies in the fact that everything – from changing domain name records, integrating CDN, hourly backups, WordPress core and plugin updates, disaster recovery and malware/DDoS protection – is managed by the hosting company. What’s the catch? Well, you’re going to have to spend top dollar every month depending on the workload you want off your shoulders. It guarantees you peace of mind and some companies like WP Engine even answer support tickets within 30 minutes, on Christmas morning!
The price is determined by the number pageviews your site generates each month. You can upgrade, downgrade and buy additional pageviews anytime. However, the term ‘pageviews’ can be a bit misleading, so we recommend reading up a bit on the provider you’re planning to host your site in, and then opt for a plan.
In an event when an article goes viral and you experience a massive traffic surge (kudos, btw!) – you won’t have to worry about downtime. All you need to do is upgrade to the next higher package or buy additional pageviews. It’s like buying bandwidth, really.
We use WPEngine to host WP Mayor and you might have noticed that our site is pretty fast. You could read our review on WPEngine, or check out a few managed WordPress hosting providers.
This concludes our CDN article. I hope you’ve learnt some new stuff today. In any case, I’d love to hear your thoughts. If you have any questions, the comment form is all yours.
If you enjoyed this post, make sure to subscribe to WP Mayor’s RSS feed.
Another CDN network to mention is Edgecast, i’d say. More and more businesses use this network to get their websites as fast as it’s possible. Because it’s no secret that nowadays it’s crucial to be able to deliver content to the end user without glitches and interruptions and almost instantly. The user doesn’t like to wait and he leaves a website very quickly if it doesn’t have a good speed.
And that’s when you need to use some CDN network. Edgecast has developed an outstanding CDN service that automatically pulls and caches new media on your site in as little as one hour. SuperPOPs (points of presence) of Edgecast are located on five continents. That means that it doesn’t matter what kind of content the user wants to get. Anyway he will get it as fast as possible, because he will get it from the SuperPOP that is the closest to his location.
At the same time adding a CDN to a website decreases the amount of processing power required to deliver your content – whether its an image, a flash video or a live streming event – to your visitors and cuts down bandwidth usage to your webserver. There is no need to say that this way you get less expenses while your visitors are satisfied and loyal and that means more revenue for any internet business.
For those, who’d like to read more about this CDN – http://jodihost.com/2014_edgecast.php
Interesting article, and great comment by Tim.
I build WordPress websites and I almost never use the media upload w/i WordPress, I tend to FTP my files manually into specific folders in the root directory.
How does that work with a CDN? Is that even a suggested method or would you recommend sticking with the media upload w/i WordPress?
There are quite a few issues with this article but let’s deal with the truly scary one first…
“Better Security: As mentioned earlier, the CDN makes copies of your website’s static data in all its servers. Any malicious attempts (except MySQL database injections) would be fruitless!”
This is utter rubbish, your server and any vulnerabilities does not change because you use a CDN, if you have badly configured folder settings before using a CDN you still have it afterwards. If you have week logins, you still have week logins, open ports still open. In most cases files are stored both on your server which is acting as the origin server and the CDN so we even have the same file on the server as we did before.
At most you could argue that a CDN adds a layer of obscurity but that is a very small factor.
The scary part is readers or your own clients might actually take that line for granted and stop worrying about there sites security, after all you have claimed ALL malicious attempts (apart from SQL injections) would be fruitless. This is simply wrong and dangerous, it also cast the rest of the article into serious doubt.
So now to come to the figures, which are unfortunately based on the data you produced appear to be less related to using a CDN but that of Total Cache which performs many other optimisations in addition to helping manage CDN content. Specifically including combining and minifying file content in effect when you were testing your CDN it had an unfair advantage as it was making significantly less requests which you can see in the Pingdom results. While CDNs do make heavy use of compression, so do most hosts these days even shared hosts should have gzip enabled so the reduction of 50% in page size makes little sense.
The sad thing is that a CDN is a good solution for a lot of people, it’s not always the case and in some cases a CDN can actually slow a site down http://www.webperformancetoday.com/2014/04/22/new-findings-retail-sites-use-cdn-slower-sites/
If you wanted to test this properly, I suggest rather then using total cache, you use a plugin, that simply changes static files urls to point to your CDN such as Mark Jaquiths’ WP-Stack CDN https://github.com/markjaquith/WP-Stack
This ultra light weight plugin, does nothing else so would be a far fairer test, it may well be you actually see even more of an improvement then using Total Cache.
When used as part of a wider performance strategy CDN can provide in some cases a significant speed boost, they are not a substitute for not optimising your server stack or using cheap shared hosting. They are not however a substitute for security practices, a good clean design, nor will they particularly save you any money indeed for most people they will increase your hosting costs.
I feel this comment may have come across very negatively and imply I’m not in favour of using CDNs and it’s quite the opposite, however the best way to encourage people to improve their site performance is through reliable data, this article in it’s current form does little to promote CDN usage and a lot to harm it.
However to give the author a bit of a get out of jail free card, there is a way to use a CDN and improve your security by basically not having a server at all and only serving static content for example https://timnash.co.uk/using-wordpress-static-site-generator/ Of course if your site is online it’s still security by obscurity, but if sitting on a laptop, with assets on Amazon s3 or some other location at least it’s someone else’s issue and not your own.
Thanks for the detailed explanation. I’ve updated my article with the relevant information, without omitting any previous text. My apologies for the carelessness.
Thanks for stopping by!