HIGH TTFB Siteground + Cloudfare

I have an issue with my website’s Huntplaza TTFB. Can someone please help me to reduce this? F Grade :frowning:

https://www.webpagetest.org/result/200118_FB_ecfe656426d62dc276f1777c6ef71f91/

Reply from support
Sometimes webpages that test TTFB aren’t very reliable as explained in the CloudFlare’s official statement as well: https://blog.cloudflare.com/ttfb-time-to-first-byte-considered-meaningles

Should I Stop worrying about TTFB ??

It is a bit on the high side. It’s just your server slow to respond. Page Caching on the server really helps.

Or, since it looks like the main page looks like it doesn’t reflect logged in users, you can cache it at Cloudflare.

Create a Page Rule to match www.huntplaza.com/ and add settings: Cache Level (Cache Everything) and Edge Cache TTL (1 day, or whatever you’re comfortable with).

Hey Thank you for the answer - I have another question to ask.

When I enabled the cloudfare in siteground , I had to add a rule in my .HTACCESS File
RewriteCond %{HTTP_HOST} ^huntplaza.com [NC]
RewriteRule ^(.*)$ https://www.huntplaza.com/$1 [L,R=301]

And When I check the GTmetrix , I see this 301. ( from non www to www )

Is there a way I can avoid this ?

Test GTMetrix from your intended primary domain which is www version of domain not your non-www

As you’re testing from WPT Mumbia India servers these 2 replies I posted here apply to your situation as Mumbia India visitors are directed to Cloudflare’s Singapore datacenters for non-Cloudflare Enterprise customers due to ISP pricing in India. That adds to your TTFB as well.

But where is your origin web hosting server located behind Cloudflare ?

As TTFB speed is relative so if your origin web server is located further away from mumbia WPT test location then TTFB is higher. If you web host was in mumbia then expect TTFB to be much faster.

This is due to Cloudflare not caching HTML content by default (see below). So for optimal TTFB speed, you want your origin real web server to be hosted in a location closest to your majority traffic visitors and then put Cloudflare in front. For instance, my forums has 50% US visitors 40% Asian visitors and 10% Oceania. So my optimal geographic location for my origin is US West Coast as it sits in middle of US, Europe and Asian so equal round trip times for majority of visitors.

Cloudflare cache certain static content https://support.cloudflare.com/hc/en-us/articles/200172516-Which-file-extensions-does-Cloudflare-cache-for-static-content- but not dynamic/static generated html itself by default (which is what WPT TTFB is testing for). But you can tell Cloudflare to cache dynamic/static generated html content to some extent depending on Cloudflare plan you’re on via cache everything page rule but have to be careful to only do this for static html content and not dynamic html content (otherwise you would cache private logged in user content).

Also you seem to have requests with HTTP response header = x-proxy-cache MISS so suggests you have a 2nd reverse proxy in front of your actual origin server and probably in between Cloudflare and your origin server so that will add latency response time overhead especially if that proxy is always considering your response as a MISS

so you probably have

CF > x-proxy-cache server > your server origin

So

  • for dynamic HTML page x-proxy-cache server is returning a MISS + CF cache returning MISS = request will be fetched from origin server backend
  • for static css/js, x-proxy-cache server is returning a MISS while CF cache returns a HIT = request could either be fetched from CF cache or at one time was fetched again from origin server backend for the 1st non-cache hit request

edit: looks like x-proxy-cache might be siteground’s static cache feature ? they also have a dynamic cache feature for your dynamic HTML too which would help your TTFB just like CF Business plan’s bypass cache on cookie I think https://www.siteground.com/tutorials/supercacher/dynamic-cache/. Don’t use siteground so no real idea.

Looks like dynamic cache https://www.siteground.com/tutorials/wordpress/sg-optimizer/supercacher/ is based off of Nginx/PHP-FPM fastcgi_cache probably. So it will improve TTFB if it does what I think it does.

I do same for my self-hosted Wordpress blog, https://servermanager.guide using PHP-FPM fastcgi_cache for guest full HTML page caching of PHP requests + Cloudflare Free plan at https://servermanager.guide/122/how-to-install-wordpress-on-centmin-mod-lemp-stack-guide/. Though on top of that I add some Cloudflare Worker based caching for finer grain control over cache times /cached url paths.

2 Likes

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