“Which CDN should you use for your WordPress site, Kinsta or Cloudflare?” This is a question we get asked all the time, especially from new users migrating to Kinsta. The short answer is, you can’t go wrong with either one. But the longer answer is that it really depends on the priorities of your site, as our CDN and the one Cloudflare offers are actually quite different.
Don’t worry, we’ll dive into the pros and cons of each below so you can make a more informed decision on which one will work best for you.
- What is a CDN?
- How to Properly Speed Test a CDN
- Kinsta CDN Pros and Cons
- Cloudflare CDN Pros and Cons
- Which CDN Should You Use?
What is a CDN?
The main goal of a CDN is to speed up the delivery of your WordPress site’s assets. Below are a few of the ways it does that.
Reduces Network Latency
Network latency refers to the time and or delay that is involved in the transmission of data over a network. In other words, how long it takes for a packet of data to go from one point to another. The further your data has to travel, the greater the latency and time it takes to load.
By copying your assets to server locations (POPs) closer to the visitor, this dramatically reduces the network latency time involved. For example, if your website is hosted at a data center in Iowa (USA), and a person visits your site from Germany, the data would have to travel thousands of miles. If you’re using a CDN, your assets are automatically delivered from a much closer location like a CDN server (POP) located in Frankfurt, Germany.
TTFB stands for time to first byte. To put it simply, this is a measurement of how long the browser has to wait before receiving its first byte of data from the server. The longer it takes to get that data, the longer it takes to display your page. A common misconception is that this is calculated after DNS lookup times, however, the original calculation of TTFB in networking always includes network latency.
One of the primary ways a CDN helps lower TTFB is through caching. Caching is the process of storing resources from one request and reusing those resources for subsequent requests. Basically, it reduces the amount of work required to generate a page view. Just like how your WordPress host uses caching, so does a CDN. When assets are delivered from cache on the CDN, they load lightning fast for the visitor.
Your site’s TTFB can vary depending on the type of CDN you’re using, which we’ll go into further below.
But before we dive into TTFB differences, it’s important to understand the two different types of content delivery networks commonly used by clients at Kinsta:
1. Traditional Pull CDNs
Kinsta CDN is a traditional CDN.
Traditional pull CDNs cache a copy of all of your content and media and utilize a subdomain or a random URL to serve the assets from, such as 123.kinstacdn.com. When someone visits your WordPress site, a request is first made from the client to your hosting provider, and then to the CDN to fetch all of the assets.
domain.com [request → WordPress host] 123.kinstacdn.com/image.png [request → CDN] 123.kinstacdn.com/style.css [request → CDN] 123.kinstacdn.com/scripts.js [request → CDN]
2. Reverse Proxy/WAF CDN
Cloudflare is a reverse proxy/WAF CDN.
A reverse proxy/WAF CDN is slightly different than a traditional pull CDN. While it still acts likes a CDN, it intercepts all incoming requests and acts as an intermediary server between the client and your host. This is one reason why you have to change your nameservers and point your DNS to them. And unlike a traditional CDN, it typically doesn’t involve the use of a subdomain or random URL.
domain.com [request → reverse proxy/WAF CDN → WordPress host] domain.com/image.png [request → reverse proxy/WAF CDN] domain.com/style.css [request → reverse proxy/WAF CDN] domain.com/scripts.js [request → reverse proxy/WAF CDN]
How to Properly Speed Test a CDN
Before we dive into the pros and cons of both the Kinsta CDN and Cloudflare CDN, we want to share with you a few tips on how to best speed test a CDN. Many don’t do this properly and therefore never see that actual performance they are getting.
You Have to Test Multiple Times Because of Caching
Remember a CDN is fast because it serves your content directly from cache. However, if you just added a CDN to your site or you cleared the cache, the content might not be cached when you first run your speed test. The cache could have also expired.
Many users tend to run a speed test once, the content isn’t cached on the CDN yet, and then it appears that the CDN is actually slowing the site down (or they don’t see any performance improvements). In our CDN speed benchmarks, we saw that a CDN can actually decrease load times in some cases by over 50%! This depends on the location you’re testing from, but in any scenario, you should see speed improvements.
How can you tell that your CDN isn’t serving the content yet from cache? It’s easy. Every speed test tool shows you what are called HTTP headers (also known as response headers). These contain important information about each request. In this example below, we are using Pingdom.
When looking at your WordPress site, you want to look at one of your assets loading from the CDN. This could be an image or CSS/JS file. When using the Kinsta CDN, look for the header called
x-cache. When it’s not serving from cache yet it will register a
To properly test your CDN, you need to see everything load from cache. When it is, the
x-cache value will register a
HIT. This sometimes requires running your speed test multiple times. We have found that two or three is usually the magic number. Some speed test tools like Pingdom also limit the time between each test (usually a couple minutes). So you might have to run your speed test, come back later, run it again, etc.
When you’re using Cloudflare, the HTTP header is called
cf-cache-status. Everything else mentioned above still applies, you will want to run the speed tests a couple of times until you see the
HIT register. This means it’s actually serving your assets from Cloudflare cache.
The Location of Your Test Matters a Lot
The location you choose when speed testing matters quite a bit. The reason is that this is all relative to the data center where your WordPress site is hosted. TTFB, network latency, all come into play.
So test your site both from a location that is close to your data center and one that is far away. Do speed tests without the CDN and then with the CDN. This will also help you see how much of an impact a CDN has on your WordPress site.
Kinsta CDN Pros and Cons
Now for the pros and cons of the Kinsta CDN. This is included on all WordPress hosting plans at Kinsta.
Kinsta CDN Pros
The Kinsta CDN is powered by KeyCDN, a traditional pull CDN. One of the primary reasons we typically recommend the Kinsta CDN over the Cloudflare CDN is because it has very low TTFB and doesn’t impact the request to your hosting provider. Remember, Cloudflare is a reverse proxy/WAF CDN, which means it sits in between your site and the host. This adds overhead which results in higher TTFB. You can get around this with page cache rules, but it’s not always easy, and we’ll get into that further below.
The Kinsta CDN features HTTP/2, is IPv6-enabled, and has 35 locations around the globe to turbocharge your assets. While Cloudflare has more locations, the very low TTFB and ease of use make the Kinsta CDN an awesome choice if you want the fastest and easiest option. You can enable the Kinsta CDN in two simple steps. There are no nameservers to change, no extra accounts to open, and no plugins to install.
To enable the Kinsta CDN, all you have to do is log in to your MyKinsta dashboard. Click on your site and then on the CDN tab.
Then click on “Enable.” After a few minutes, the CDN is automatically deployed, and your assets will be served from cache around the globe. That’s all there is to it.
Kinsta CDN Cons
The biggest con of the Kinsta CDN is actually that it isn’t a reverse proxy/WAF. Why? Because it doesn’t always do a great job at filtering out bad bots or malicious traffic. Remember this type of traffic is usually hitting your site directly, not your assets. Therefore, using the Kinsta CDN will typically not help reduce bad traffic to your site. This means the visits to your site will be higher than if you used a reverse proxy/WAF solution such as Cloudflare.
We do not count visits from well-known “bot” user-agents and do our best to filter them out of our analytics data. However, bots have also been known to spoof user agents, in which case they might appear legitimate in our access logs. Read more about how we count visits.
We include a generous amount of CDN bandwidth with each hosting plan. For many of our clients, they never go over this amount and therefore the CDN is usually free. However, if you do go over the amount then we charge you $0.10/GB. While this is very cheap, it can be seen as a con, as it might not be free for you depending on the volume of traffic you get and the type/size of media on your site.
Cloudflare CDN Pros and Cons
Now for the pros and cons of the Cloudflare CDN.
Cloudflare CDN Pros
Cloudflare is really good at blocking bad traffic to your site. They’ve been doing this for a long time and have decades of filters/rules you can use. If you are wanting to keep your total visits down on your Kinsta hosting plan, using Cloudflare can definitely help! It’s important to mention that the free Cloudflare plan doesn’t include the web application firewall (WAF). However, it still does protect against some types of bad traffic.
If you are wanting to keep your visits down as much as possible, we always recommend using the Cloudflare Pro plan at $20/month which includes the WAF. This will drop your visit counts even more. Cloudflare is great for high-traffic and popular sites which are more likely to be targeted by bots, scrapers, and crawlers. Check out the difference in the Cloudflare plan features.
Cloudflare is fast and has the most number of servers locations (POPs) of any CDN provider on the market. Their network consists of over 165+ POPs.
They also have a multitude of performance and security features you can take advantage of. One of these, Cloudflare Railgun, we offer as an add-on here at Kinsta. This is available for $100/month/site. This ensures the connection between your origin server and Cloudflare network is as fast as possible. This is available to clients with Cloudflare Business or Enterprise plans.
Cloudflare CDN Cons
Now for the Cloudflare CDN cons. The first is that you have to change your nameservers to point directly to Cloudflare, versus the Kinsta CDN where no DNS changes are required if your site is already hosted with us.
The most common issue users have with Cloudflare is that by default you are going to see higher TTFB. Remember, Cloudflare is a reverse proxy/WAF that intercepts all incoming requests and acts as an intermediary server between the client and your host. This means it impacts your initial HTTP request as well as your assets. The result is that it comes with some overhead. You can see below that TTFB with Cloudflare (also known as wait time) was 141.1 ms.
Does TTFB matter? It contributes to your overall speed, so yes. Now if you take a look at a site using the Kinsta CDN, the TTFB on the initial request is much lower at 33.1 ms. Remember, the CDN only handles assets, so this initial request is directly from the Kinsta servers.
Some might argue though that the higher TTFB with Cloudflare is negligible when compared to all the awesome things they do to protect your WordPress site.
While the TTFB with Cloudflare is higher, you can decrease your TTFB with page caching rules. This essentially makes it so that your WordPress site actually serves entirely from cache on the CDN. It’s basically mimicking the full page cache that we offer at Kinsta.
However, the downside to this is that page cache rules can be complicated to set up. You also need to be familiar with exactly what you should and shouldn’t be caching. Things like your comments, WordPress admin toolbar, eCommerce checkout pages, are all things you would need to configure properly with page cache rules.
You also can’t bypass cache when a cookie is detected unless you’re using the Cloudflare Business or Enterprise plan. Remember, at Kinsta, we have server-level rules in place for eCommerce sites to automatically bypass the cache when the
woocommerce_items_in_cart cookie or
edd_items_in_cart cookie are detected to ensure a smooth and in-sync checkout process. If you implement full page caching rules you’ll need to also configure this.
The free Cloudflare plan also only comes with three page cache rules.
With all that being said, if you set the rules up properly, it’s really fast. Check it out, with full page caching set up with Cloudflare, our TTFB was under 20 ms!
If you want to go down the full page caching rule route, we recommend checking out these tutorials on how to set these up:
If you’re confused or need help, we recommend hiring a WordPress developer to help.
You might also experience the following warning in speed test tools when your WordPress site is behind Cloudflare: “Serve static content from a cookieless domain.”
You cannot disable cookies on resources served through Cloudflare. Cloudflare includes their own security cookie in your header. However, these cookies are very small and the performance implications are extremely minimal. But if you use Cloudflare, there is no way to get around this warning. You will not get this warning when using the Kinsta CDN.
When using Cloudflare, you will also want to install their WordPress plugin. This enables things like automatic cache purge when you publish new content. Otherwise, you would need to visit the Cloudflare dashboard to purge the cache manually or wait for it to expire. At Kinsta cache is automatically purged when you publish new posts.
It’s also important to note that the free Cloudflare CDN plan is actually slower in some parts of the world.
Which CDN Should You Use?
Hopefully, you’ve learned a little more about the Kinsta CDN and Cloudflare CDN and now have a better idea of which one will work better for your site. Again, you can’t really go wrong with either one. We have many clients using both. To recap:
- Has very low TTFB and is blazing fast. If performance is what you’re after, we recommend using the Kinsta CDN.
- Easy to use, you can set it up in seconds. No changing of nameservers required or having to worry about page caching rules.
- It’s usually free. If you go over the included bandwidth, it’s still very cheap.
- It doesn’t do a great job at filtering out bad bots or malicious traffic.
- Is an excellent solution to block bad traffic. This can help you keep your visit count down on your Kinsta hosting plan. We always recommend the Cloudflare Pro plan which includes the full WAF.
- Due to the fact that the Cloudflare CDN is a reverse proxy/WAF, it has higher TTFB due to the extra overhead.
- It’s possible to decrease the TTFB, but it requires page rules. Depending on the complexity of the site, these can be a pain to set up and might even require a higher Cloudflare plan.
- The free Cloudflare plan is slower in some regions.
- Requires a WordPress plugin if you want to ensure proper functionality such as automatic purging when publishing new content.
- You have to change your nameservers to point DNS to Cloudflare.
If you think we’ve missed anything, please leave us feedback below.