Slow load after settng up CloudFlare


I have a VPS where I run some sites.

2 of the sites is set up with Cloudflare and both of them loads slower than the others without Cloudflare.

Example ; - with cloudflare (Load is slow) - technically the same site on the same server, but without Cloudflare (Load is ok)

I have also run 2 tests. 1 via Cloudlare and one directly to the server/sites IP.
The result showed that Cloadflare was a bit faster… :huh:

Links to results;

Have anyone experianced similar? Any tips?

You’ve answered your own question.

CloudFlare is great for fixing very slow + poorly tuned LAMP Stack sites.

For well tuned sites, avoid CloudFlare or any other tech which stands between your site + your visitors.

My experience with Cloudflare is long but generally good when setup properly. My own impatience has sometimes led me into error when initiating CF. When transferring nameservers to CF I know I’ll have to wait until they resolve and CF Dashboard shows ‘Active’.

‘Active’ can be misleading. It took an additional 12-18 hours beyond DNS resolution for CF’s CDN servers to begin delivering content to WPT, and to other testing tools! So be certain that you are more patient than I am before drawing your download speed conclusions.

Time To First Byte on both tests are very long. My first action would be to find better hosting, and to make sure that ‘Keep-Alive’ is enabled on their server. A host that won’t supply that feature at a minimum is not one you should use.

Best of luck!

Those two sites are quite different. One is 2MB, the other one is 1.7MB. One has 5 fonts, the other one just 4. One has more JS, more images etc. than the other one. That’s enough to explain any performance difference between them.

The two tests you presented show almost exactly the same performance when you discard initial redirect from this test:
(substract 2230 from SpeedIndex and other appropriate values).

And now for “why” it seems slower with CF:

Why the first one is just slow and the second one is slow as hell? Because in the second one you make a request to JS that either doesn’t exist and it triggers long running 404 handler or is processed by PHP and times out. Or it’s infinite redirect loop to very slow resource. Or dozen other reasons. Either way JS blocks page rendering until it times out and hence the difference.

Actually I ran:
:~$ curl -H “Host:” “

And it hasn’t responded with either content nor error code for five minutes. At this point you can pretty much clear CF out and focus on why your server takes so much time to respond to this request.

As datadiggers said, focus on your site speed.

Trying to debug CloudFlare problems tends to suck massive amounts of time + rarely produce useful results.

Remove CloudFlare + fix your site speed (hire someone if required) + then determine your next steps.

What about international websites. Is it not better to use a service like CF to deliver some static content nearby the location of the user directly by cache?

I think this might be helpful. That’s why I setup Cloudflare for my webprog24 website. The performance did not change and I asked people from all over the world (Mexico, India, USA) about the loading speed. They all say that the first time hit is better on this website. But that’s it.

Use an oldschool CDN then. If you want it to be geo-aware, remember that you may well need a geo-aware DNS service to run it.

Because CF attempts to dumb everything right down, it has to proxy your web page, and that will always make it slower.

A CDN ( in the original meaning of the word? ) will - once set up - deliver static resources from a local source. Combine this with decent expires headers for them, and you should both lower the stress on your web server, and improve performance for the customer.

Once you’ve set that up, you need to size and configure your web server to deliver in a performant manner - but at least you don’t have to tune it to deliver static content at the same time.

EDIT: I see you’re running drupal. Don’t forget to install a full page cache at application level too.

I’m having this issue too, ran same site before and after linking up with Cloudflare.

Have already tried optimized what I can, so it’s green across the board. I’m testing all using 3G traffic as most of my visitors are mobile.

My server is Digital Ocean at New York, so I tested at New York, London and Singapore. All 3 showed that without Cloudflare is faster.

I tried testing on Pingdom too. With Cloudflare, the yellow (waiting) time are so long. Once I unhook Cloudflare, the downloads are almost instantaneous, though they don’t start together.

Any tips?

my website is hosted by US servers and is targeted at Middle East visitors:
____Without Cloudflare when test with webpagetest we get 2 seconds loading time from USA and 5 seconds from Middle East.
____ With cloudflare implemented we get 2 seconds loading time from the USA and 10 seconds from Middle East!!!:@:@
I tried to implement Cloudflare twice and sadly I always get worse results >> maybe the quality of their servers and DNS resolution from Middle East is poor and worse than relying on website served from USA servers!!! - very strange results

This is the reason why i prefer going with managed services, so I have don’t have to deal with this kind of stuff. Example, Cloudways PHP web hosting platform support team could have dealt with this kind of stuff if it was hosted on their own platform. This saves me a lot of time and trouble.

Cloudflare is a decent solution when you have a website that is perhaps a target for DDOS and your existing hosting provider doesn’t have there own prevention capabilities.

As far as performance, Cloudflare has some of the fastest DNS resolution on the market currently. I tested a number of Cloudflare hosted sites vs. AWS Route 53 and it blew them away. I was surprised how fast it was. They posted a blog entry recently about it.

The other component is the actual transit of the web data. It typically goes into the closet Cloudflare location, gets routed towards the origin server (via something such as normal internet / leased line / vpn?) and out connecting back to the origin server.

In almost all cases a direct connection from a browser to a server will be faster than running it thru someone elses network that often includes scrubbing and html altering capabilities.

It could also depend on how the origin server is configured. If it waits until the entire webpage itself is generated before transmitting, or if it starts outputting right away. A browser would start to receive data quicker and could process it. I would imagine with Cloudflare they need to fetch the entire HTML webpage so they can analyze / process/ optimize it before sending it back to the requester.

Rule of thumb - when you correctly optimize your application directly - it’s almost unbeatable.