Categories
Hosting Comparisons Speed

StackPath vs Cloudflare: Which CDN is Faster?

Two major content delivery networks, benchmarked.

We’ve had lots of users ask why we choose StackPath as our CDN provider, instead of a more popular option, Cloudflare.

Well, first off, when we reached out to Cloudflare, they told us they were sun-setting their Optimized Hosting Partner program. There goes that.

In the end though, we chose StackPath because of its developer-friendly platform, as well as the speed benefits it brought, compared to Cloudflare.

PoPs

Cloudflare has over 170+ Points of Presence around to the world, while StackPath only has 45+ PoPs. That said, more PoPs aren’t necessarily good. More PoPs mean that more edge caches have to be primed for a website to achieve the full benefits of a CDN. With StackPath, you’d need at least 45 different requests from different locations for every user to hit a cached copy. With Cloudflare, you’d need over 170 different requests to hit all PoPs.

For low-medium traffic sites, this can actually slow your site down, as Cloudflare purges infrequently accessed pages, meaning more origin pulls are required.

TTFB

Cloudflare argues that Time-To-First-Byte is not as important as others say. Yet, TTFB is one of the most widely used benchmarks of server performance. We used KeyCDN’s performance tool to measure the TTFB of cached pages from various locations.

Cloudflare

StackPath

StackPath consistently beats Cloudflare by 2-3x, except Bangalore, where StackPath doesn’t have PoP but Cloudflare does.

Load Time

Next, we also tested the time it took for each CDN to load an image fully. This one from our previous post, specifically.

We benchmarked this multiple times using Dotcom Tool’s website speed test from all its locations.

RoundStackPathCloudflare
Uncached973 ms1.1 sec
Cached 1421 ms466 ms
Cached 2359 ms372 ms

We did multiple rounds of testing cached performance since the numbers were so close, but overall, we found that StackPath almost always beat Cloudflare by 20-60 ms.

We also tested the load time of a full website homepage — our blog — when fully cached at the edge. We used FastOrSlow for this.

RoundSP Full LoadSP TTFBCF Full LoadCF TTFB
Uncached1.5 sec582 ms1.6 sec604 ms
Cached 1423 ms89 ms563 ms95 ms
Cached 2445 ms111 ms554 ms93.6ms

We see again here that StackPath generally pulls ahead in both fully loaded time and TTFB, albeit by a 30-60 ms usually.

Latency

Another important factor is how much latency each CDN adds. Both are proxy CDNs, which mean all requests go through the respective provider’s network before hitting the origin. This can potentially add extra network hops and cause delays on uncached origin pulls.

To test this, we used Cloudflare PageRules and StackPath EdgeRules to set the cache level of all urls (*) to Bypass and tested our site with FastOrSlow. Origin NGINX cache was enabled and primed for both sites.

RoundSP Full LoadSP TTFBCF Full LoadCF TTFB
11.33 sec534 ms1.64 sec637 ms
21.4 sec595 ms1.68 sec652 ms
31.36 sec565 ms1.66 sec636 ms

Here are the raw latencies for the same website without any proxy:

RoundFull LoadTTFB
11.4 sec454 ms
21.37 sec452 ms
31.36 sec453 ms

We can see that when it comes to latency, StackPath blows Cloudflare out of the water, with a 300ms difference in fully-loaded time, and 100ms difference in TTFB. In fact, StackPath comes pretty close to unproxied latency.

Large Files

Finally, we uploaded a large (17MB) image to our origin server and served it through Cloudflare and StackPath to see which one delivered it faster, when cached.

We ran FastOrSlow 5 times.

RoundSP Full LoadCF Full Load
112.64 sec14.36 s
213.44 sec14.28 s
311.04 sec11.33 s
412.24 sec 12.66 s
511.01 sec14.74 s
Average12.07 sec13.474

Here, we see again that StackPath beats Cloudflare by a few seconds when it comes to loading large files also.


Overall, we see StackPath consistently beating Cloudflare by 10-20% when it comes to overall load time, latency, and TTFB.

A few ten or hundred milliseconds may not seem like much, but when it comes to CDNs and last-mile delivery, they matter very much so. We’ve partnered with StackPath to provide a blazing-fast CDN free, with our high performance plans that can accelerate your content delivery by factors of 2-5x. Plus, StackPath’s unlimited EdgeRules allow us to customize each site’s caching behavior to guarantee the best performance.

4 replies on “StackPath vs Cloudflare: Which CDN is Faster?”

It’s not fair comparison
If you really want to compare you should have pikcked from several locations from around the globe
You have missed to add South Africa, Brazil, Middle East and Australia
I’m sure Cloudflare will beat Stackpath easily

Problem is that very few people care about Brasil and even fewer about ZAR.

And when it’s time for those regions to start being relevant stackpath will cover them.

Can clodflare solve their problem with company culture and suboptimal development and operation practices ? I would not be so sure.

Leave a Reply

Your email address will not be published. Required fields are marked *