GoogleChrome / web-vitals

Essential metrics for a healthy site.
https://web.dev/vitals
Apache License 2.0
7.46k stars 409 forks source link

differences in TTFB in safari vs chromium based browsers #424

Closed adardesign closed 7 months ago

adardesign commented 7 months ago

While monitoring multiple websites using web-vitals I noticed that there is a huge consistent difference in TTFB between browsers I checked separately mobile vs desktop traffic Shouldn't TTFB measure the backend and network which should be the same across browsers.

image

tunetheweb commented 7 months ago

TTFB measures more than just the backend time. It measure the time from when the click happens, through any redirects, and SSL/TCP set up, the resource request, until the first bytes are returned.

Therefore it is hugely influenced by the users networks and devices, not to mention HOW they get to your site (directly, from an ad with redirect, from a link using a link shortener with a redirect?), and not just your backend performance time.

Doing a quick query from the rumarchive public dataset on BigQuery:

SELECT DEVICETYPE, USERAGENTFAMILY, AVG(TTFBAVG) as AVG_TTFB, SUM(BEACONS) as BEACONCOUNT
FROM akamai-mpulse-rumarchive.rumarchive.rumarchive_page_loads
WHERE (DATE BETWEEN '2023-12-01' AND '2023-12-31')
GROUP BY DEVICETYPE, USERAGENTFAMILY
ORDER BY BEACONCOUNT DESC

You see that Safari often does have a lower TTFB than Chrome:

DEVICETYPE USERAGENTFAMILY AVG_TTFB BEACONCOUNT
Mobile Mobile Safari 886 1,488,156,723
Desktop Chrome 929 1,305,147,671
Mobile Chrome Mobile 961 784,312,202
Mobile Mobile Safari UI/WKWebView 726 544,977,427
Mobile Chrome Mobile WebView 867 416,299,416
Desktop Edge 902 333,017,611
Desktop Safari 802 206,702,655

I imagine this is more reflective of the types of users and networks that use Safari than the browsers themselves though. Limiting it to just GB/UK for example reduces these differences, but even then doesn't account for socioeconomics differences likely affecting network speed.

Anyway, point is this is not unexpected and you can probably analyse your data more to find similar reasons.