Does CloudFlare speed up your site?

AN ANALYSIS OF CLOUDFLARE PERFORMANCE​

Cloudflare offers free Content Delivery Network (CDN) to cache the static resources on your website or blog.  It can also prevent DDoS (Denial-of-service attack) by stopping illegitimate volumetric traffic. In the present article we’ll only focus on Cloudflare CDN performance. Does Cloudflare speeds up your website ?

What is a CDN ?

A content delivery network (CDN) is a geographically distributed network of proxy servers. The goal is to provide high availability and high performance by distributing the service as close as possible to the end user. CDNs serve a large portion of the Internet content today, by delivering static content (images, files, css) all over the world. Our hosting plan includes a CDN with Cloudflare.

Cloudflare, a free CDN ?

In opposite to the others CDN services (like Stackpath or KeyCDN), Cloudflare uses a network technology called Anycast to route initial DNS lookups for your domain to the Cloudflare data center closest to the visitor. Cloudflare has 155 data centers and is supposed to deliver your content faster from one of its data center back to your web server than would be available to a visitor directly requesting your site. Even with Cloudflare between your website and your visitor, traffic will often still arrive to your visitor sooner.

"Even with Cloudflare between your website and your visitor, traffic will often still arrive to your visitor sooner"

Sooner, really ?

So we decided to test this affirmation…. For this experiment, we used the homepage of SouthswellDesign. We set up a Cloudflare account. Then we redirected the DNS towards CloudFlare. Finally we performed10 tests on PingDom. We tested the 7 locations available for each of the 4 conditions we tested (total of 280 measures ). The tests were done at different time of the day, over several days.
4 different conditions were tested :

  • No CDN at all (Direct DNS to SouthSwellDesign)
  • DNS directed to CloudFlare (but system "paused")
  • CDN + Cache
  • CDN + Cache + Speed (minify + Brotli + Rocket Loader)

Results

.

Cloudflare speed analysis

Surprising results !

Globally Fast

First of all, independently of the configuration we chose,  the website was able to load in under 3 seconds. (Except for Sydney,). 3 seconds is the maximum loading time recommended by google ( 2 seconds for E-Commerce).

"2 seconds is the threshold for e-commerce website acceptability. At Google, we aim for under a half second."
Google

Pausing CloudFlare speeds up your site!

One of the most surprising effect was the loading time when the DNS were pointed towards the CDN  with the service on pause. Pausing the service causes the IP address to be returned by Cloudflare’s nameservers, sending traffic directly to it rather than through its reverse proxy. I was expecting to see a loss in performance, it was actually the opposite. All seven locations were faster when our DNS were pointing passively through CloudFlare.

CloudFlare Caching could to slow down your site

Then, we decided to activate the CDN, except the performance settings (‘Speed tab’). Surprisingly the performance dropped down, and became even worst than without a CDN. That was the case for every location.

Performance settings, a good thing ?

Finally, we activated the performance setting that CloudFlare offers (Those available in the free tier : ‘Enable Accelerated Mobile Links’, ‘Brotli’ and ‘Rocket Loader’). I did not use the their auto minify option as my code was already minified. The loading time went back to the level when the service was paused. It was rarely offering better performance except for Washington and San Francisco. Activating Speed performance allowed us for those 2 locations to drop below 1 second (less than 0.5 second for Washington). For Sao Paulo, our site became actually slower than even without any CDN activated.

Conclusion

Although some have seen that Cloudflare could slow down their sites, I would say that usually Cloudflare speeds-up your site, even if the results are not as spectacular as we could expected, especially in countries that are particularly far from the hosting server. When the rocket loader is activated, I see however a pretty good reduction of the page loading time.The other really interesting point about using a Cloudflare (or any CDN) is about saving bandwidth. Because Cloudflare serves static content from its servers , Cloudflare allows us offload bandwidth on the origin server