From searching around, it looks as though issues with Time To First Byte (TTFB) when using Cloudflare have been discussed at great length.
Despite my reading on the subject, I just wanted to canvas some thoughts on my situation.
A few years ago on Google PageSpeed we used to get the warning, “Reduce initial server response time” which I believe is PageSpeed’s TTFB metric. We used to get this warning mostly on WordPress websites which are notorious for running dozens of SQL queries per page view. We started using a caching plugin for most WordPress installs which got rid of this warning and to the keen eye speeded up page views by a fraction of a second.
Now we’ve implemented Cloudflare, and this dreaded warning is back. Depending on the time of day, sometimes it goes away, sometimes it registers as over 1 second. We don’t ever get this warning on a WordPress site that is cached at the origin and NOT using CloudFlare.
Using Webpagetest.org yields similar results - a non-Cloudflare site scores an “A” on TTFB, and a site on Cloudflare tends to score a “C”. These sites are all hosted on the same origin.
As an experiment, I set a site to “cache everything” at CloudFlare. The TTFB warning remained the same on Google PageSpeed, and bizzarely scored worse via Webpagetest.org compared to when HTML is not cached. In any case, we need to utilise the WordPress admin bar for logged in users, as well as a bunch of other things that will cause disruption by caching HTML at Cloudflare.
Our sites are hosted in the Netherlands, and I checked the IP address used by Google PageSpeed which revealed its location was also in Europe, so it’s not that Google PageSpeed is connecting via a Cloudflare server far away in the USA.
Finally, using Chrome Lighthouse tools on my local PC, there is no complaint about TTFB - in fact it is typically around 90ms. The actual loading of the sites themselves are fast - from my location at least. The entire page seems to load and render in less than half a second. The Cloudflare server responding to my requests is in the UK (which is where I’m based).
It seems as though if we’re going to reap the benefits that Cloudflare offers, this warning is a side effect we have to put up with. I’m guessing it’s simply the time it takes to fetch non-cached HTML from the origin, to Cloudflare, back to whever the test is being run from.
I guess the question is, should I just forget about this now, and move on, or is there anything else we can do?