Surprisingly slow TTFB. Index not downloaded from Cloudflare?

dash-crypto
#1

Hi there!

I’m trying to figure out why my TTFB is so slow, and after trying basically everything I found in these forums (and beyond) to no avail, I feel like it might just be time to post a question myself.

In short, I’m trying to optimize a website I’m hoping to launch soon. While there are things left to improve like image resizing, the main bottleneck appears to be TTFB, and I just can’t figure out why it’s so slow.

Some potentially pertinent details: I’m on shared hosting with SiteGround, and the website is hosted in Europe. I run Cloudflare (free plan) with most speed-related features turned on, e.g., minifying CSS, JS, HTML, and Brotli. I turned Rocket Loader off because it caused some issues with elements popping in and out as they loaded, and I left Railgun alone as well.

In the Wordpress backend, I used the plugin supplied by my host to remove query strings from static resources and enable Gzip compression. Other than that, I turned all extra server-side caching and minifying off to leave that for Cloudflare to deal with.

I use Let’s Encrypt SSL, which if I understand things correctly, should encrypt transfers between my host and Cloudflare without interfering with Cloudflare’s universal ssl certificate.

Finally, for the time being, my website is essentially a single product store, so it’s basically an index page + basics like privacy policy, terms, etc. + WooCommerce pages like checkout. With that in mind, I figured I might as well use “cache everything” as a page rule to improve load times further. At the very least, it should make the index page load directly from Cloudflare, ensuring quick delivery (or so I thought!).

The problem: Connecting from where I live, in Taiwan, I get 1.6-3 second TTFB. Picking a server near the location of where my website is hosted, I can get it down somewhere around 0.6-1 second with WebPageTest.org’s testing tool, earning me a not-so-fine D TTFB rating.

From what my untrained eyes can tell from the waterfall in Vivaldi’s (or Chrome’s) developer tools, the actual index page isn’t downloaded from Cloudflare. To me, that would explain why I’m scoring better in Europe, where the site is hosted. What I can’t understand is why.

Any ideas as to what may be causing this (or, if it’s me expecting CF to do something it can’t) would be much appreciated. I’m attaching a screenshot of what things look like on my end as well as my page rules. You can find the website address in the screenshots.

Thanks!
waterfall-miss

#2

I was facing similar issue but I was lucky to have my cloud server relocated to North America based region and TTFB improved. Here is the discussion on it.

#3

They do provide with Argo service which is a paid service. But I didn’t found it more effective as compared to relocating my server to North America based region from where Cloudflare has assigned me the IP to my domain.

#4

Your index files (and all you .php, .html, etc… files) are coming from your own server and taking an extra long route when you’re using CloudFlare’s free service.
Only your images are supplied from their own network. All other files are requested from your own webserver, so they are taking a detour through CloudFlares servers before they get to your webbrowser. Their network is actually requesting the .HTML or .PHP file from your server, possbily converting them if selected and then serving it to the browser.

#5

I really can’t explain why, but Siteground’s own optimization plugin (Siteground Optimizer) works perfectly for one of my websites, which has a highly customized theme, with custom posts and pages, but for some reason I never managed to make it work well with another site with a different theme, but one that is less customized.

Also, I could not make it function properly in a standard WordPress installation using Twenty-Nineteen of any other default WP theme.

Somehow, for those sites that I tested and it didn’t work, the generated HTML page was never cached by Cloudflare, due to some caching headers including “no-cache” or “max-age: 0” settings.

I tried several settings on SG Optimizer, and even edited manually the .htaccess section that SG Optimizer adds, to no avail. I even brought that up with SG support, but they said this was a WP issue that I should investigate, something I’m not equipped to do, as I have zero knowledge of PHP programming.

At the end, I kept SG Optimizer for the site where it worked well with Cloudflare, and reverted back to WP Super Cache for the ones where it didn’t.

Perhaps you should bring this up with their plugin support and see if you get a better explanation for this behavior.

When and if you make this work for you, you need to add extra page rules to make sure the pages under /wp-admin/ and /wp-json/ are not cached.

#6

Thanks for all the suggestions and pointers!

I experimented with my SG Optimizer settings and even deactivated the whole plugin, but neither seemed to make a difference in achieving the desired result.

It did, however, put me down the right path of solving this issue. What I ended up doing was to edit my “cache everything” rule slightly by adding an Edge Cache TTL setting. That’s it.

Now I’m down to <150ms TTFB and a more-than-satisfactory A rating when running WebPageTest and 60 ms from where I’m sitting right now. A huge improvement!

1-minute summary for those who may find this post with Google in the future: SSL conflicts, plugin conflicts, etc., do not appear to be the source of the problem. Try using Edge Cache TTL with your page rule and see if it does the trick.

1 Like
closed #7

This topic was automatically closed after 30 days. New replies are no longer allowed.