What is the best CDN for WordPress

WordPress CDN - Why You Should Use One in 2021

As a performance hosting company, we are happy to research and share ways to make your WordPress site faster. One of the most important factors for speed today is the use of a content delivery network (CDN). You relieve your web server and speed up the delivery of content to your visitors, which improves their experience!

Today we just want to explain to you how a WordPress CDN workswhy you should use one and what additional benefits come with it. We're also going to run some speed tests so you can better judge how much

You can expect performance improvement on your own website.

What is a WordPress CDN?

CDN is the abbreviation for Content Delivery Network. This is a network of servers (also known as POPs) that are located around the world. They are designed to serve copies of the static (and sometimes dynamic) content on your WordPress site such as images, CSS, JavaScript, and video streams. - Kinsta Support

How a CDN works

First, you shouldn't confuse a CDN with your WordPress host. These are completely separate services. A CDN is not a replacement for your hosting provider, but an additional way to increase the speed of your website. While our hosting is blazingly fast here at Kinsta, a CDN can make your website even faster.

How exactly does a CDN work? Well, for example, if you host your website with Kinsta, you need to choose a physical data center location, such as US Central, Europe, South America, or Asia. Say you choose US Central. This means that your website is physically on a "host server" in Council Bluffs, Iowa. When people in Europe visit your website, it will take longer to load the page someone who is from Dallas, TX is visiting. Why? Because the data has to travel a further distance. This is what is known as the latency period. Latency refers to the time and / or delay involved in transmitting data over a network. The further the distance, the greater the latency.

40 percent of visitors abandon a website if it takes over three seconds to load. ⏱Click to Tweet

Several network hops (communication instances between network devices) are also required in order to transmit data requests from browsers to the hosting server and the requested content from the hosting server to the web browser. And this is exactly where a CDN comes in. It helps reduce this latency by loading your website's content from servers nearby. These CDN servers are sometimes referred to as POPs (points of presence).

A CDN reduces latency

WordPress users can sometimes hesitate to delve into content delivery networks as they can be a bit overwhelming at first. But don't worry, we will explain to you in three simple steps how to implement the setup:

Step 1

You choose a CDN provider and subscribe to their service. These are usually billed monthly or according to data usage. Most providers have a calculator to estimate your costs.

step 2

Download a free plugin like CDN Enabler or WP Rocket to integrate it. These plugins automatically link your assets to the CDN. No work is required on your part to get your content onto the CDN, it all works without any problems! Deploying a CDN is much easier than it was a few years ago.

step 3

Now when people visit your website it will download the content of your WordPress site from various CDNs around the world. For those visitors in Europe who visit your website in Iowa, your content will now download from a POP in Europe. How do you do that? CDNs typically use two different types of technologies to direct users to the right place, and that is IP anycast + geolocation. You can automatically see where the user requests are coming from and forward the requests to the nearest POP.

However, it's still important to choose a strategic server location for your WordPress host. Because even if a CDN supports the distribution of your media and content, a single request must be sent to the hosting provider when your website is loaded. Unless you're using full-page caching on a proxy server, which we'll get into later. Kinsta now has 25 data center locations from which you can host your WordPress site.

CDN benefits

Below are just a few of the many benefits of using a CDN on your WordPress site.

1. Increase in performance

Increasing performance is one of the main reasons for using a CDN. It has been shown time and again that a faster loading time correlates directly with higher conversion rates, lower bounce rates and a longer average visitor duration. Not to mention a simply better user experience all around. When was the last time you clicked back in your browser because the website took too long to load? But don't believe us, here are some stats for you from some of the leading industrial companies:

  • Delaying the page response by 1 second can reduce conversions by 7%. (Source: Kissmetrics)
  • The BBC has seen that for every additional second it takes for their website to load, they lose another 10% of users. (Source: Creative Bloq)
  • 53% of visits to mobile websites are canceled after 3 seconds, according to a study by Google’s DoubleClick. (Source: DoubleClick)
  • AliExpress reduced load times by 36%, saw orders grow 10.5% and new customer sales increased 27%. (Source: Akamai)

Here are some ways a CDN can help improve the performance of your WordPress site.

Reduces the TTFB

We mentioned earlier that a WordPress CDN can help reduce latencyby reducing the physical distance required to transfer data. But it can also help to shorten the time to the first byte (TTFB). Simply put, this is a measure of how long the browser has to wait to get its first byte of data from the server. The longer it takes to get this data, the longer it will take to display your page.

A CDN can help reduce the time to TTFB.

A common misconception is that this is calculated according to DNS lookup times, however the original calculation of TTFB on the network always includes network latency. This involves a 3-step process and delays and latencies can occur anywhere in between, adding up to your total TTFB time. A high TTFB can be caused by a number of reasons, such as bad code or misconfigured caching on your server. But geographic distance is definitely an actor. We did a little test to show the difference to our Kinsta CDN (powered by KeyCDN). Each test was carried out 5 times and the average was taken.

TTFB without CDN

We first ran a test with the CDN disabled and as you can see, our total load time was 1.45 s and our average TTFB on an asset was around 136 ms.

TTFB before we added the CDN

TTFB with CDN

Then we activated our CDN and ran the test again. As you can see, our total load times have dropped to 788 ms and our average TTFB is now 37 ms! What a difference a CDN can make! Another important thing to note is that we chose Stockholm as the location for this test. Why? Because we wanted to show you the real improvement that can be made by reducing physical distance. There is a CDN POP in Stockholm so our content is served from Stockholm.

Note: If you're using Cloudflare, you may have a slightly higher TTFB. This is most likely due to the added overhead and complexity involved in running the full proxy service. Keep in mind that Cloudflare has additional firewalls and other features that some CDN providers don't. So you have to decide for yourself what will bring you more benefit. If your entire website is not properly optimized, it could be worthwhile to imitate the slightly higher TTFB of the security of your website.

However, you should also check out WP Bullet's guide on Using Cloudflare Page Caching to Lower TTFB. This may require some additional settings and testing. Make sure you do your own testing as every environment is different. Cloudflare's new Argo service has also been shown in some cases to lower the TTFB.

Faster delivery through caching

Just like you use caching with your WordPress host or a plugin, CDNs also use caching. That's one way they can deliver files so quickly. One important thing to keep in mind, however, is how caching works. As soon as a CDN receives a copy of your media, it usually has to be requested once or twice by a visitor before it is actually cached in the CDN. A CDN puts an HTTP header on the requests called "X-Cache". Typically on the first or second request, the file will show up as MISS, which means it has not yet been cached.

CDN no cache (MISS)

For later inquiries it will be displayed as HIT, i.e. it will now be cached on your CDN. It stays in the cache based on a variety of factors such as ETag headers, expiring headers, or manually cleaning the CDN cache.

CDN cache (HIT)

If you're using a full proxy CDN like Cloudflare, you can also take caching to the next level by using what is known as full page caching. Everything is cached on a URL. However, with WordPress sites this can be tricky at times as they need to implement workarounds for dynamic parts of your website.

Huge savings through GZIP compression

WordPress CDNs also use GZIP, a file format and software application for file compression and decompression. GZIP compression is activated on the server (or on the CDN server / POP) and enables the size of your HTML, stylesheets and JavaScript files to be further reduced. It doesn't work with images because they are already compressed in some other way. Some have gained up to 70% less weight from the compression. It's probably one of the easiest tweaks you can make. And don't worry, all major CDNs have this enabled by default.

You can see how you use a tool like Check GZIP Compression or Chrome DevTools to see a huge difference that compression is making. For example, below you can see that in our jquery.js file served by a CDN, GZIP compression reduced the size from 94.9 KB to 33.6 KB. That's a saving of 64.59% on just one file. Add this to all of your assets and media and you will see why compression is essential!

GZIP savings on a CDN

Brotli takes compression to the next level

Brotli is a newer compression algorithm developed by Google that has been shown to reduce file size by up to 26 percent over existing solutions, including GZIP. The acceptance rate for Brotli is growing quite quickly. Since June 20, Google Display Ads has even been compressing with Brotli compression.

Brotli compression savings (source: SamSaffron)

However, since Brotli is still new, it is not yet available from all CDN providers. But there are a few like KeyCDN and CDN77 that support it now. In most cases, your origin server (hosting server) must also have Brotli activated for this to work. And browser support for Brotli is also catching up. If set up correctly, servers that have Brotli activated but are loaded in a browser that does not support it will simply fall back on GZIP.

HTTP / 2

HTTP / 2 is also one of the biggest features that all CDNs are now using to accelerate the provisioning of assets. HTTP / 2 needs HTTPS because of browser support. The improvement in performance is due to a variety of reasons, such as the protocol, which can support better multiplexing, parallelism, HPACK compression with Huffman encoding, the ALPN extension, and server push. There used to be a significant TLS overhead when using HTTPS, but thanks to HTTP / 2 this is a thing of the past.

2. Lower bandwidth costs

Another big advantage of a CDN is that it can help to relieve the CPU and resources of your hosting server (original server). This helps prevent spikes in traffic from overwhelming your host. It can also help lower your bandwidth costs. For example, below is a website with Cloudflare, and as you can see, Cloudflare helped off 69% of bandwidth requirements.

Cloudflare - saved bandwidth

Another way to reduce costs is to have a CDN provide easy ways to enable hotlink protection. This essentially refers to restricting HTTP speakers and preventing others from embedding your assets (images - we have a tutorial on how to protect your images) on other websites. Some of you may have heard of the Huffington Post fiasco. A Huffington Post writer copies and pastes images from Oatmeals’s website, earning him a bill for over $ 1,000 from AWS. The owner of Oatmeal’s website replaced the images so that readers of the Huffington Post article could see them. But that's why it always is important to activate the hotlink protection, otherwise there could be a huge bill.

Hotlink protection

3. High availability and scalability

CDNs also offer high availability and scalability. Because the replicated content is available through multiple POPs in different geographic locations, web traffic is dynamically routed to another server if one goes down. And there is no need to worry about scalability as CDN providers are designed with that in mind. If you're using a smaller shared host, a CDN could actually prevent your website from crashing as they handle most of the load.

4. SEO benefits

Google made website speed a ranking factor back in 2010, so it's no secret that a faster website could lead to higher rankings. While there are no statements from Google as to how much emphasis is placed on speed, you can safely assume that it is one of the most important factors as it has a huge impact on usability. Brian Dean analyzed the top 1 million domains to examine the relationship between page speed and Google rankings and the results were very positive. While these tests are almost impossible and cannot be conclusively proven, you can be sure that a faster website will help you with Google. Put simply, Google rewards fast pages.

Page Speed ​​- Google Rankings

In addition to speeding up the pages of your website, a CDN can also help increase the crawl rate of your media such as images that correlate with indexing in Google image search.

5. Additional security

Many CDN providers offer additional security by allowing you to implement Web Application Firewalls (WAF) and so-called Origin Shields. These can help mitigate DDoS attacks on your WordPress site of all shapes and sizes, including those targeting the UDP and ICMP protocols, as well as SYN / ACK, DNS reinforcement and Layer 7 attacks. Further advantages are that you stand behind a proxy that helps hide your original IP address.

Read our case study on how to stop a DDoS attack. We had a client with a small e-commerce site that runs Easy Digital Downloads that did over 5 million inquiries within 7 days brought to a single page. The website usually only generated between 30-40 MB of bandwidth per day and a few hundred visitors per day. But out of the blue the site immediately went over to 15-19 GB of data transfer per day! This is a Increase of 4650%. And Google Analytics didn't show any additional traffic. This is not good.

Ddo's attack

The customer implemented Sucuri's web application firewall on their website and all bandwidth and requests immediately went back to normal (see below) and there hasn't been a single problem since then. So definitely a good investment and time saver if you run into problems like this.

Would you like to know how we increased our traffic by over 1000%?

Be one of the 20,000+ people who receive weekly newsletters with insider tips about WordPress!

Subscribe now

After adding the Sucuri’S WAF

CDN’s also offer additional functions such as secure tokens, with which you can generate secured links with an expiry time. After this period, people will no longer be able to access this content.

CDN speed tests

Instead of just telling you how useful a WordPress CDN can be, let's run some tests to actually show you the results. We carried out 5 tests at 4 different test locations, once with the CDN activated and then without the CDN. The website is hosted at Kinsta and uses the Kinsta CDN (powered by KeyCDN). The physical location of the server is in Iowa, USA.

Make sure you run a CDN speed test a few times so that the media is cached. As already described above in connection with CDN caching, the X-Cache HTTP header shows a "HIT" after caching. If it is not cached, a "MISS" will be displayed. If you don't do this correctly, it might appear that the CDN is not helping speed up your website, even though it just hasn't actually built the cache yet.

Without CDN (Dallas, Texas, USA)

We have 5 tests first without CDN in Pingdom of Dallas, Texas, performed and taken the average.

Without CDN test in Dallas (Source: Pingdom)

Without CDN (Melbourne, Australia)

We then have 5 tests without CDN performed in Pingdom of Melbourne, Australia and taken the average.

without CDN test in Australia (source: Pingdom)

Without CDN (San Jose, California, USA)

We then ran 5 tests without CDN in Pingdom out of San Jose, California and took the average.

Without CDN test in San Jose (Source: Pingdom)

Without CDN (Stockholm, Sweden)

We then have 5 tests without CDN performed at Pingdom in Stockholm, Sweden and taken the average.

Without CDN test in Sweden (source: Pingdom)

With CDN (Dallas, Texas, USA)

We then ran 5 tests with a CDN in Pingdom out of Dallas, Texas and took the average.

With CDN test in Dallas (Source: Pingdom)

With CDN (Melbourne, Australia)

Then we performed 5 tests with a CDN in Pingdom from Melbourne, Australia through and took the average.

With CDN test in Australia (Source: Pingdom)

With CDN (San Jose, California, USA)

We then ran 5 tests with a CDN in Pingdom out of San Jose, California and took the average.

With CDN test in San Jose (Source: Pingdom)

With CDN (Stockholm, Sweden)

We then have 5 tests with a CDN performed in Pingdom from Stockholm and taken the average.

With CDN test in Sweden (source: Pingdom)

The results

Now let's take a look at the results to understand how much a CDN affects overall load times.

CDN speed comparison

  • Dallas, Texas, USA: 8.11% decrease in overall load time with a CDN.
  • San Jose, California, United States: Overall load time decreased 33.02% with a CDN
  • Melbourne, Australia: Reduced total load time with a CDN by 54.19%.
  • Stockholm, Sweden: Reduce overall load time by 54.7% with a CDN.

As you can see, Dallas and San Jose are a little faster with a CDN. If you look at the Australia tests, you can see a huge difference between load times. This is due to the geographic location of the test server. Our server is in Iowa, so the data doesn't have to travel that far when loading from Dallas and San Jose. But for Australia, it's distance that kills load times. When we activate the CDN, the content and media will be loaded from a Kinsta CDN POP in Sydney Australia resulting in much faster download times. The same goes for Stockholm, Sweden.

Now the question arises whether you want to reduce your loading times by over 50% in some cases. The answer should be yes!

Do you need a CDN?

One question we are often asked here at Kinsta is whether or not a CDN is required for a particular website. In our experience, a CDN can be beneficial in almost any scenario. Just take a look at all of the benefits we've listed above. The price usually doesn't matter anymore as most CDN providers are very cheap, some only charge $ 0.04 / GB. And then Cloudflare is even free. The only times you might want to run further testing is when you're only serving content to visitors in a specific geographic location.

For example, let's say you have a small shop with a website in Ontario, Canada. So if your server is in Ontario, but the POP of your CDN is in the USA, it would actually slow down your website. In this case you shouldn't use a CDN. Granted, this case is extremely rare, but that was just an example.

Popular CDN providers

There are many great CDN providers to choose from. Most of them have free trials, so we recommend trying a few to see which one works best for your website. We have a free CDN integration for all customers here at Kinsta that is based on KeyCDN. Here are some other third-party providers that you should check out:

How to install a CDN in WordPress

Each CDN provider has their own method of integration, but luckily they all support WordPress and make integration very easy. Make sure to read the documentation or ask the support team if you have any problems.

Kinsta CDN

We have teamed up with KeyCDN, an HTTP / 2 and IPv6-capable content delivery network with 34 locations, to boost your assets and media worldwide. The regions currently served include America, South America, Europe, Africa, Asia and Australia.

Kinsta CDN

Learn how to activate the Kinsta CDN. It's a simple one-click process from the MyKinsta dashboard.

Add CDN zone

We also have clear CDN analysis so you can see bandwidth usage, top files by request, HTTP status codes and more.

CDN usage in analytics

Cloudflare

If you use Cloudflare or are interested in Cloudflare, we have put together a detailed tutorial on how to install Cloudflare on your WordPress site.

Third party CDN

If you want to deal with the provision of KeyCDN yourself, we recommend reading this article on CDN for dummies.

One thing we recommend is using a subdomain for your media and assets instead of the random URL the provider gave you. Example: cdn.yourdomain.com. This will ensure better branding for your website and fewer problems with indexing. After you have set up your CDN with the provider, you can use a free WordPress plugin such as the CDN enabler to easily link your assets and automatically copy them to your CDN provider.

CDN enabler

Other plugins like WP Rocket or W3 Total Cache also have similar integration methods.

CDN in WP Rocket

It is important to load as many resources as possible from your WordPress site. This ensures faster delivery to visitors and the use of a single HTTP / 2 connection. You can run your website through a tool like Pingdom to see where your media is loading from. Sometimes themes or certain plugins can be tweaked a bit, or you can investigate why they are not loading from your CDN even after the integration is complete.

Indexing of images with CDN

You have to make sure that the images are still indexed on Google even after the integration of the CDN. For users of the Yoast SEO plugin, you need to add the following code to the end of your functions.php file. Of course, replace the domain and CDN domain with your own.

Failure to do this could result in your images being de-indexed (as shown below). You can always check this yourself in the Google Search Console.

Images not indexed

However, we also found that there are some inconsistencies in the Google Search Console stating that all images are indexed. A great way to verify that your images are really indexed is to turn to Google image search and type in:.

Google Image Search - Check Indexing

Important: Do not enter your CDN url. Even if images are served from the CDN, they should still be indexed on their root domain. If your images appear in Google Image Search, it means they are well indexed.

Summary

Hopefully, now you can see all of the amazing benefits that you can expect from using a WordPress CDN. It ensures that your media get faster around the globe, it reduces your TTFB and drastically lowers your bandwidth costs and server load. Not only that, but you'll also see better rankings as the page load times get faster. And most importantly, your visitors will have a much better user experience.

Don't forget, our HTTP / 2 Kinsta CDN is now on the plan for all of our hosting customers. Do you have any thoughts on using a CDN? We'd love to hear your thoughts in the comments below.


If you enjoyed this article, then you will love Kinsta’s WordPress hosting platform. Speed ​​up your website and get 24/7 support from our experienced WordPress team. Our Google Cloud based infrastructure focuses on the areas of auto-scaling, performance and security. Let's show you the Kinsta difference! Check out our packages here