I’m currently working on a webshop (not launched yet). I try to optimze the WP webshop as much as possible.
I’ve some extensions installed like WP Rocket and currently working on http/2 but with combined cache (seems to load better then not combined js/css)…
I also use Cloudflare and i serve scaled images.
The problem is that im facing with a slow TTFB if the website is cached. If i clear my cache the website seems to be much faster due to the reduced TTFB (waiting) time. This will saves me 4/5 sec on the full run.
See below an example of the test with cache cleared and without…
Hopefully you guys can see/read what causes this delay…
And how to improve the first paint as example…
The loading time isn’t probably the worst thing, i think the first pain of the site is most important…
The test results seems to be different based on the geo location as well (sometimes 1 - 2 sec.)
I have no experience with Cloudflare, therefore I am not 100% how exactly they interact with your server. Furthermore, I do not understand whether you are talking about the local cache, in your case WP Rocket, or Cloudflare’s (edge) cache.
But what I noticed in the long TTFB requests: The cache-control header sent by your server has a value of max-age=0. In these cases Cloudflare signals a cache-status of BYPASS. Thus the request has to go through to your origin server.
In the cases of short TTFB your server emits a cache-control header of max-age=16070400 and CF serves a file directly from its cache.
But even here the setup does not seem ideal: In addition to a cache-control header, your server also shows en expires header, with time set to the current time. Thus CF has to revalidate the page it cached due to the cache-control header. This can be seen here cf-cache-status: REVALIDATED