Time to first byte > 500 :(

Anatoliy

Well-known member
So I checked my forum with the Site Audit from Ahrefs. It scanned 20k pages. Average html file size - 11k. All of them are compressed with Brotli.

Time to first byte​

86% are "Too slow" (>500ms). 14% ate "Slow" (300-500ms).

Load time​

88% are "Medium" (500-1000ms). 11% are "Fast" (<500ms). Average load time 680ms.

Is there a way to make TTFB "Fast" (<200ms) or at least "Medium" (200-300ms)? Can load time of html file be "Fast" (<500ms)?
I have VPS, use redis cache (pages for guests), so those htmls should fly as static pages, right? Or I don't understand something?

Could someone help me crack this case, please?
 
So I checked my forum with the Site Audit from Ahrefs. It scanned 20k pages. Average html file size - 11k. All of them are compressed with Brotli.
Hmm ... running brotli on dynamic content is usually slower then gzip.
XF Guest Page Cache won't help for that, as the response will be compressed for every request.
You can check the page cache status by checking response header X-XF-Cache-Status.

Do you have enough traffic so the cache does get hit?
Keep in mid that the default lifetime is 300 seconds, so if the average time beween two hits for the same URL is larger than 300 seconds it won't help much (if at all).
 
Last edited:
Hmm ... running brotli on dynamic content is usually slower then gzip.
I'm completely lost in this one and have no idea what to do. )
I have Gzip enabled on my server. Cloudflare offers Brotli and their docs say that Brotli compresses better than Gzip. So I enabled Brotli on CF. Or it was a bad idea to compress with Brotli when it already gziped?

XF Guest Page Cache won't help for that, as the response will be compressed for every request.
You can check the page cache status by checking response header X-CF-Cache-Status.

You mean x-xf, not x-cf, right? I'm not on Business plan, so can't cache pages for guests on CF.
Do you have enough traffic so the cache does get hit?
Keep in mid that the default lifetime is 300 seconds, so if the average time beween two hits for the same URL is larger than 300 seconds it won't help much (if at all).
I increased it to 900, but I don't think it changed much. I have about 1k visits a day. Not enough to keep pages cached.
Should I turn off redis caching for pages?
 
Do you mean to throw Cloudflare into a garbage can?
I don't want to put it that simply. I mean, if XF is already doing compression and caching then there shouldn't be any other tools compressing and caching because all these different tools have to check it again, which costs time. This time adds up and this is how your high TBT comes about.

You can only find out what is best for your setup by testing. My advice is that caching 5 times is usually slower than caching once. It's the same with compressing.
 
You mean x-xf, not x-cf, right? I'm not on Business plan, so can't cache pages for guests on CF.
Yes, was a typo :)
I increased it to 900, but I don't think it changed much. I have about 1k visits a day. Not enough to keep pages cached.
Should I turn off redis caching for pages?
I can't say for sure without having access to your logs, but at such a low traffic volume I'd expect page cache to have a hit rate very close to zero.

I'd check PHP-FPM access/slow logs to see if there are requests that take well > 200 ms.
If there are such requests you'll have to investigate why they are slow, eg. turn on XF debug mode to get some insights or use a profiler like XDebug.
 
is that a thread with attachments or forum home?
Thats Forumhome.

A heavy long thread, with GoogleAutoAds is this:

1615523421459.png
Without optimal server settings in Apache and Mysql etc it would look different ...

so what? ;) I have AMP and then, the same thread:
1615523667917.png

For such discussions you should always use forumhome as a basis, it is most comparable. (imho) ;)
 
Last edited:
Disabled redis page cache for guests. Didn't change anything. A quick scan for 50 pages... TTFB looks ugly. (

View attachment 248343
What kind of test page is that?
It should also be noted that servers, both within the Cloudflare network appear faster than pages / servers that are inside vs. outside the Cloudflare network.
You will only get really suitable data if you test your pages directly without Cloudflare in between.
 
Back
Top Bottom