Why it matters
- Nothing of the page can be shown before its answer starts: the time to first byte comes before every other measure of loading, the largest contentful paint included.
- web.dev counts 800 ms or less as good, and more than 1,800 ms as poor.
- A server that answers slowly also slows search engines' crawlers: Google lowers how much it crawls a site that slows down.
- A slow first byte usually comes from the server's work before it answers: a page built anew for each visitor, slow database queries, a busy or distant server.
How to fix
Have the page ready before it is asked for:
nginx
location / {
proxy_cache pages;
proxy_cache_valid 200 10m;
proxy_pass http://app;
}- Cache whole pages that are the same for every visitor (product, category and article pages), in the platform's cache, the server's, or a CDN's.
- Find the slow part of building the page: the platform's own logs, or its profiler, usually name the queries or plugins that take the time.
- Serve the site from a place near its visitors, or through a CDN that has servers in the Gulf.
How we detect
- We fetch the page once, as
ArablyzerBot, from our server, and measure the time from the start of the request it answered, its address's lookup and its connection included, to the first byte of its answer. Redirects before that request are not counted. - The rule fails when that time is over 1,800 ms, and says nothing below it.
- It is one measurement from one place: a busy moment of the server, or of the network between us, can explain it. Measure again, and compare with real visitors' data (the Chrome UX Report, Search Console) before acting on it. It is not real visitors' data, and says nothing of ranking.