Extremely high TTFB latency (5000ms) with Cloudflare, none (40ms) without

I have seen these brought up before, so have been doing some tests. I have two servers running the exact same website with the same configuration. They are imaged from each other the one exception is that one resides in Sweden and one in Amsterdam. If I apply Cloudflare and point the DNS to the IP address of the Amsterdam site it runs perfectly, if I switch the site to the Sweden site it fails miserably.

When I say fails miserably I am talking about 47ms without Cloudflare and 5000ms with Cloudflare. I do not have any Rocketloader or other turned on.

So to be clear: Amsterdam website with and without Cloudflare is performing well. Cloudflare on the Sweden site adds about 4.5s to 5s of overhead spent in “Waiting”.

When accessing either site via direct IP or direct DNS they work perfectly (40ms on Sweden and 150ms on Amsterdam) - given that I am in Sweden that is expected for me.

Without Cloudflare (IP or DNS):

With Cloudflare:

Server TR to Cloudflare:

For the life of me I cannot figure out what is going on. Disabling proxy drops it back down to normal speeds for Sweden site.

Again if I just point the IP to the Amsterdam site with the same webpage and proxy it does not have the 5s load time.

Possibly something to do with the way the DNS is handled?

If I check TTFB with curl on the CF DNS vs the IP:

curl -ko /dev/null --resolve ##DOMAIN##:80:##IP## \ -H 'Cache-Control: no-cache' -s -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" ##DOMAIN_URL##
Connect: 0.004394 TTFB: 0.023870 Total time: 0.028981 

curl -ko /dev/null --resolve ##DOMAIN##:80 \ -H 'Cache-Control: no-cache' -s -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" ##DOMAIN_URL##
Connect: 0.104336 TTFB: 5.141142 Total time: 5.141170 

If I switch the DNS to my other server, then issue the same command:

curl -ko /dev/null --resolve ##DOMAIN##:80 \ -H 'Cache-Control: no-cache' -s -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" ##DOMAIN_URL##
Connect: 0.035223 TTFB: 0.123984 Total time: 0.133614 

… still kind of lost as to why this could be.

For public consumption, I found some interesting things when using webpagetest.org

My test pool was:

  1. kimchicat.se - Cloudflare DNS pointed to server (dev mode, proxy mode, etc. dont change outcome)
  2. - Direct IP address of server
  3. limping.ninja - Non-Cloudflare DNS pointed to server IP

When performing any tests from London, Amsterdam, Ireland, Stockholm EC2 I get the results:

  1. 9.7s
  2. 0.3s
  3. 0.3s

Respectively re: the Testpool BUT if I use the local Stockholm (Non EC2) testing harness the results are:

  1. 9.7s
  2. 9.7s
  3. 9.7s

That 9.7s is comprised of 4.7s TTFB and 4.7s parallel wait for image then processing.

This only appears to happen if I use the Stockholm Non-EC2 test harness. At this point I am wondering if there is something particular about this Stockholm data center location and the ARN Cloudflare POP location that is injecting this wait time in.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.