TTFB includes the time required data packets to be transferred from the webserver to your device through all of the network nodes like routers, wi-fi subnetworks, etc.
In other words, TTFB is always slower than the raw server response time. In short - the closer you’re to the server - the less TTFB you’ll get.
Please, run the
ping example.com -c 10
command on the device where you’re getting bad TTFB (where
example.com is your website domain).
You’ll see something like that:
$ ping example.com -c 10
PING example.com (193.70.37.175) 56(84) bytes of data.
64 bytes from 175.ip-193-70-37.eu (193.70.37.175): icmp_seq=1 ttl=51 time=59.4 ms
64 bytes from 175.ip-193-70-37.eu (193.70.37.175): icmp_seq=2 ttl=51 time=60.3 ms
64 bytes from 175.ip-193-70-37.eu (193.70.37.175): icmp_seq=3 ttl=51 time=60.8 ms
64 bytes from 175.ip-193-70-37.eu (193.70.37.175): icmp_seq=4 ttl=51 time=60.8 ms
64 bytes from 175.ip-193-70-37.eu (193.70.37.175): icmp_seq=5 ttl=51 time=60.6 ms
64 bytes from 175.ip-193-70-37.eu (193.70.37.175): icmp_seq=6 ttl=51 time=60.0 ms
64 bytes from 175.ip-193-70-37.eu (193.70.37.175): icmp_seq=7 ttl=51 time=60.8 ms
64 bytes from 175.ip-193-70-37.eu (193.70.37.175): icmp_seq=8 ttl=51 time=60.3 ms
64 bytes from 175.ip-193-70-37.eu (193.70.37.175): icmp_seq=9 ttl=51 time=60.1 ms
64 bytes from 175.ip-193-70-37.eu (193.70.37.175): icmp_seq=10 ttl=51 time=60.1 ms
— example.com ping statistics —
10 packets transmitted, 10 received, 0% packet loss, time 9033ms
rtt min/avg/max/mdev = 59.479/60.369/60.885/0.528 ms
‘60.369’ from the last line is the averate round trip time (RTT) in ms, a time required for TCP packet to get to the destination server. This is a time between sending the TCP packet and receiving a confirmation of it’s successful (or not) trip.
So, this RTT is a network latency you can’t avoid, it will be included into your TTFB one or more times depending on the network quality (in case of the packet loss, which is very common for wi-fi networks, the packet will be sent again, so you have to wait one more RTT plus the time required to admit the packet was actually lost).
It’s a very common mistake to measure website server software perfomance using the TTFB you’re getting at your device, which can be influenced by a lot of factors unrelated to server performance.
Of course, such metric (TTFB at the endpoint device) is a logical endpoint, measuring how fast end-user will receive the page. However, fixing the bad TTFBs should include more complex steps like server geotargeting (placing a server closer to the country which generates most traffic/sales) or geo-replication, meaning you have a lot of servers across the world for highest service availability