You can learn how to secure a WordPress site with CloudFlare CDN in this SitePoint Premium course (requires a Premium subscription).
The Internet has a need for speed; that much everyone already knows. But why is this so important for your WordPress site, and why should you use a CDN for WordPress to help with your site’s loading times?
You’ve probably seen the 3 second loading time chart many times. It, and countless charts just like it, are everywhere.
There’s a reason for that though – page loading time affects conversions. It’s as simple as that. And what are most WordPress sites aimed at, ultimately? I know that my sites are all focused on somehow making money. Whether they’re affiliate sites or service-based websites, they’re all aimed at converting.
If loading times affect conversions, then a fixation on speed is a good thing!
Take a look at four reasons that you may want to use a CDN for WordPress sites that you build or manage.
1. Your Site Will Load Faster with a CDN
This is one of the strongest selling points of setting up a CDN for WordPress.
One of the biggest speed killers for your website is distance . Specifically, the distance between your hosting server and the visitor’s browser. Whilst the size of your page makes a real difference, the distance the content has to travel can definitely be the largest bottleneck in website loading speeds.
Ideally, your visitor needs to be as physically close to the hosting server as possible.
Unfortunately, setting up a hosting server at a location which is physically close to any one particular visitor is all but impossible — unless you are setting up a CDN, that is.
The very idea of a Content Delivery Network (CDN) is exactly that. A CDN’s primary purpose is to set up as many servers as possible in different geographical locations, such that anybody who hits the service is as physically close as possible to one of the locations.
Have a look at the following image from Incapsula CDN (one of my preferred services) which explains the concept perfectly.
You can see that there are many CDN server points. In this manner, all visitors, in any location in the world, are always served content from a location which is (relatively speaking) near to them.
Hosting static content on a CDN network is the closest you can get to creating a global hosting setup for your website.
2. Your Website Will be Safer with a CDN
The next reason why a CDN is essential for your website is security.
Did you know that more than 51% of the web’s traffic actually comes from bots rather than humans?
When I first saw this report, I was completely taken aback:
The even scarier statistic from the above is that 29% of web traffic comes from malicious bots.
That means your website is constantly under a deluge of bad bot traffic. If you’ve ever taken a look at analytics data, or used a security plugin like WordFence, you’re already aware of this fact.
These bots are constantly probing your site for vulnerabilities. If you slip slightly in your security efforts, if you have not chosen a good WordPress host, or if you miss a WordPress security update or a plugin update, rest assured your site will soon be suffering the consequences.
Most CDNs are able to identify and block bad bots rapidly, making your site safer when plugged into a CDN. The collective knowledge gained by the network can be used to prevent attacks on your own sites.
3. Your Site is Protected Against Traffic Based Attacks with a CDN
I’m sure you’ve been stuck in traffic at least a few times in your life. I know I have. Getting stuck in traffic is a waste of productive time and money.
The same concept applies to your website.
However, it’s even worse when somebody purposely sends an overwhelming amount of traffic to your website.
In a Distributed Denial of Service (DDoS) attack, an army of compromised web servers or computers (or even IoT devices) are recruited to send so much traffic to your website, that your legitimate users unable to access it.
If your website is the lifeline of your business, a DDoS attack can literally bring your business to a standstill. Regardless of whether you’re on a shared hosting server or a dedicated server, your website won’t be able to keep up with the flood of traffic.
The same concept used by a CDN to make your website fast, can also work in your favour by absorbing malicious traffic over a global network of servers fronting your website.
Most CDN implementations use the concept of reverse proxy to serve your website. The reverse proxy will be the CDN server network.
This means that your website’s visitors (both benign and malicious) will hit the CDN server closest to them before they hit your site’s actual server.
In this manner, any malicious traffic is intercepted before it actually gets to your server. CDNs have intelligent algorithms which are able to identify malicious DDoS traffic and kill it.
Incapsula, MaxCDN, KeyCDN and most of the top players all have support for mitigating traffic-based attacks.
4. Faster Web Design and Development
When you’re creating a WordPress site which is meant to be fully optimized for performance, you’re going to have to perform a number of additional implementation steps.
You’ll be looking for an image optimization plugin, a content minification and combination plugin, a static and dynamic content caching plugin, and other tools to fully optimize the WordPress website. While it may be possible that one or two plugins are able to actually serve most of your optimization needs, you’ll still need to perform additional testing to ensure the plugins are able to operate correctly.
Personally, I’ve found that optimizing with various plugins is a nightmare of epic proportions.
CDNs are actually able to perform all of the above mentioned optimizations in one fell swoop. Image optimization, dynamic file compression, static and dynamic content caching are all built-in into the CDN.
Coupled with that, there are other optimizations such as Custom Content caching rules to fix any problems with specific plugins on your site.
Most of these performance optimizations are going to be hard to achieve with your typical WordPress plugin.
Such stuff as session reuse optimization (particularly for HTTPS websites), TCP Connection pre-pooling and rapid purging all improve the optimization.
Other improvements such as improving the SSL/TLS handshake process would not be something which the typical developer would be capable of optimizing by themselves. Having this completely handled by the CDN gives a significant boost, particularly to HTTPS websites, which unfortunately take a hit in performance when enabling HTTPS.
All of these above optimizations decrease the design and development time with the website whilst pushing the performance envelope as far as it can get.
A CDN catering for all of the above will drastically reduce the time spent on optimization.
How to Actually Set Up a CDN for WordPress
If you choose a reverse proxy enabled CDN, it is absolutely simple to setup, with just a couple of changes to your DNS settings. Those changes will immediately route traffic through the CDN and immediately deploy all of the benefits of that CDN.
While you might have seen plenty of articles mentioning the need for installing a CDN plugin to be able to serve static content and images from a CDN, I’ve written elsewhere about how your typical CDN plugin works (i.e. by rewriting the source of your site to reference the CDN’s URL rather than that of your site). However, this is only necessary if you are using an upload CDN.
If you’re looking for a WordPress CDN plugin, there’s plenty of choice in the WordPress plugin directory.
While installing a CDN plugin will make your website faster, your site won’t be benefiting from most of the advantages you learned about in this article. Instead, you should be implementing a CDN the way other non-WordPress websites do – using a reverse proxy CDN.
Conclusion
Speed is typically the most obvious benefit of using a CDN that people will mention over and over again.
While the website loading speed is a critical component, and an essential justification for setting up a CDN, this should not be the only selling point.
The other points mentioned, particularly performance, security, protection and better optimization are just as important as website loading speed.
Have you set up a CDN on your WordPress site(s), or used CDN plugins? Let us know about your experiences in the comments below!
David is an inquisitive web designer who frequently shares his tips and tricks at CollectiveRay . When he's not blogging about web design, something he's been into for the last 12 years, he's usually dreaming about his next big thing.