Slow TTFB on Dynamic Cache - Woocommerce Store

Hi All,

Please help me to understand more about TTFB on Cloudflare. I have this woocommerce store that is proxied through Cloudflare free plan. Recently I have an issue with slow TTFB when accessing my website. The TTFB always more than 1s and even more than 2s:

image

image

Now, when I created the page rule to cache everything on my home page, then the TTFB significantly improved to less than 400ms.

Now you would think that the problem lies on my server. However, I have this staging site which is not proxied through Cloudflare. The staging site hosted on the same exact server. And I have no issue with TTFB being slow:

image

All this time I thought edge cache on Cloudflare will always improve my TTFB as it directly sends the first byte to the client’s browser for the static content. And most of my contents on the homepage are static. So I assume the first byte did not have to wait for the origin server response. Did I misunderstand something?

As my site is an eCommerce store, I can’t afford to cache everything on my home page as the customer would see inaccurate stock availability (I hide items that is out of stock)

Any explanation and tips for the best Cloudflare setting for woocommerce site will be much appreciated. I really don’t want to leave Cloudflare, but if I could not solve this TTFB issue then I might need to change my nameserver back to the original NS.

Unfortunately, Cloudflare cache is per-resource. So if you open up a browser’s Dev Tools (F12 in Chrome), the Network tab will show you a list of resources, such as /, something.css, something.js, something.jpg, etc. The / is your home page and is a single resource.

Cloudflare can cache static resources, so the something.css, something.js, something.jpg are static. The /, as you know, is not static, as it changes per customer. That has to come from your server, and Cloudflare can not speed up that TTFB. The rest of the resources, however, should speed up dramatically as Cloudflare’s cache loads up those files and then make your site faster overall. Hopefully.

1 Like

Hi, thanks for your quick response. Now, as I mention my staging site also hosted on the same server with same configuration to the live site and it able to give good TTFB. Then, why when proxied through Cloudflare the performance degraded significantly? How can I check where the issue is (cloudflare DNS / my server response time / time needed to proxy the traffic back to client / etc)?

here are the gtmetrix waterfall for my staging site (not through cloudflare):

meanwhile, on my live site:

Is that expected result/normal when you proxying traffic through Cloudflare and not cache everything?

For static assets yes.
For dynamic assets no.

For dynamic content CloudFlare will even increase the TTFB by a little bit. But these are just 5-10 ms nothing more.

Yes and no, all you assets are static, but the HTML itself is not and most probably never will at a shop. Thats why CloudFlare will not help much in a Shop when it comes to TTFB but on general PageLoad.

That tells you, that your site should be dynamically. What it is.

Definitely thats for sure the case.

Same server ok, but is it also hosted witht he exact same settings? Also as these are two “different” pages could you just test your mainpage without CloudFlare and see how TTFB performs then. Because what you have done now is:

Example 1: different Application, different CF settings (no CF)
Example 2: different Application, different CF settings (with CF)

Now that two variables changed in two example it makes it impossible to say where the problem comes from.

What I would like you to do is:

  1. run GtMetrix again on www.mooeishop.id and post the result URL
  2. disable CloudFlare (Developermode etc) and run it again on www.mooeishop.id and then again post the GtMetrix result URL here.

That will make sure there is just one variable beeing changed and this helps us to see where the problem comes from.

Hi, thanks for your response. I’m trying to make it the exact same setting. The only different is the staging site has Really Simple SSL plugin active (as the SSL certificate is not handled by Cloudflare).

Here are the requested test result:

What I would like you to do is:

  1. run GtMetrix again on www.mooeishop.id and post the result URL >> Cloudflare Active

  2. disable CloudFlare (Developermode etc) and run it again on www.mooeishop.id and then again post the GtMetrix result URL here. >>
    image
    development mode is active (I’m not sure how to check if it’s already deactivated). I also purge all cache before doing testing. Test results: Development Mode On

When I first setup Cloudflare on my website (around August 2020), I have this slow TTFB issue and was really happy with it. I’m not aware of any changes that might slow things down on TTFB aspect.

After this I also want to change the nameserver so it totally bypass cloudflare and see the result.

I have not had a chance to change the nameserver, so based on the results above are everyone agrees that the problem lies on my hosting?

Updates: now I also tested my website on giftofspeed website where I can choose the testing location and they have Singapore as an option. The results are satisfying with TTFB of only 34ms. Anybody using this website to measure page speed?

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

Hi @mooeishop2019 sorry for the late reply.

These tests:

CloudFlare :orange: : https://gtmetrix.com/reports/www.mooeishop.id/wz1AJEVm/
CloudFlare :grey: : https://gtmetrix.com/reports/www.mooeishop.id/yhAFFkeh/

Are showing that CloudFlare speeds up your site by about 100%.

But these tests have been made from “Vancouver, Canada”. I would definitely keep CloudFlare activated and let it speed up your site.

If you have changed anything on the Website since then the chances that this affected the speed are much higher then that CloudFlare is the problem.

This request also was served by CloudFlare, so CloudFlare does not seems to be the problem here. But I anyway would recommend you a good origin Caching Tool/Framework/Plugin or whatever. But the problem seems to be at your origin Server and not at CloudFlare.

Also I’m not a big fan of LiteSpeed Cache, but thats personal prefference. For your startpage (and all other NON-WooCommerce sites) I would recommend static caching. This I think is the fastest for your usecase.

1 Like

FYI, you can compare them side by side too https://gtmetrix.com/compare/wz1AJEVm/yhAFFkeh

1 Like

Noted, I will keep the Cloudflare and will try to optimize my site more. I know it’s not related to Cloudflare but what is the cache plugin that is recommended to use along side with Cloudflare (if there’s any)? I have problem with WP-rocket not showing accurate stock as it doesn’t have the option to purge the cache when stock changes.

I’m thinking of creating a landing page with cache all rules in Cloudflare as it provides the best speed for the customer.

Did you try this WP Rocket addon? Update products on stock after new Woocommerce orders - WP Rocket Knowledge Base

I don’t use WooCommerce but this sounds like what you need.