I host my websites with Cloudways and have my DNS on Cloudflare. When the A record is proxied through Cloudflare, there is a noticeable increase in TTFB on subsequent page requests (most likely the initial request as well but harder to demonstrate). Other than the DNS proxying, the sites are running the same code and both have the frontend cached with Varnish. The server is in Sydney and I am testing from Melbourne.
The higher TTFB when proxied is present across all page requests and is quite consistent. The same behaviour can be seen on other sites hosted on the same server with Cloudflare hosted DNS.
Recently (a few months back, when this issue started occurring) Cloudways introduced a new integration with Cloudflare (similar to the setup that Kinsta and WPEngine have, same issue does not occur on those hosts), which is when we believe this issue started occurring.
Here are the links for review
https://rara.studio/ - Proxied DNS - Slower TTFB
https://stage.rara.studio/ - Not proxied DNS - Fast TTFB
For me the TTFB on subsequent requests are as follows
https://rara.studio/ - Proxied DNS - ~580ms
https://stage.rara.studio/ - Not proxied DNS - ~32ms
Your server is located in Sidney you say?
Looks pretty good to me:
This issue is more noticeable on subsequent page views when browsing the site. Not really something that can be seen with automated testing that easily.
Take the following screenshots from the chrome network tab for example. The TTFB on rara.studio is ~579ms where as the TTFB on the stage.rara.studio is ~32ms.
It’s connecting to the same URL two times for some reason
One is a service worker. I don’t know if it’s intentional, but that could be your problem. You may want to double check your Cloudflare / cloudways settings.
Thanks Sarang. I’ll review the service worker but for the sake of this thread, I have removed the service worker as I believe it to be a red herring. If you review rara.studio again in a private browser or with the cache cleared the TTFB will still be high and you wont see the service worker anymore.
As for reviewing the Cloudflare/Cloudways settings, everything in Cloudflare is default and Cloudways has a bit going on as its a control panel for a VPS but on the most part its standard.
I have a theory about the TTFB. When the Cloudflare proxy is enabled, the varnish cache is being bypassed. This is contradicted by the fact that the varnish cache (managed by the Cloudways plugin called Breeze) comments are in the footer of the HTML and the headers on the response indicate the request is served by the cache. The reason I believe this is that the TTFB when the proxy cache is enabled is similar to that of a user who is logged in to WordPress (screenshot below).
The Varnish cache seems to be working as I can see the headers. x-cache: HIT;
If you are concerned about TTFB, you may want to try the Cache Everything page rule. Or Cloudflare’s APO feature?
Your site seems pretty static. So it can work.
I am using it on my site and work pretty well. TTFB under 100 ms across the globe.
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.