How TTFB is measured
TTFB starts when an HTTP client begins a request and ends when it receives the first response byte, usually part of the status line or headers. It includes request travel, server waiting and processing and return travel.
The measurement boundary depends on the tool. Browser Resource Timing often uses requestStart to responseStart. curl’s time_starttransfer measures from the start of the transfer, so it can include DNS, TCP and TLS setup. Record the tool and whether it reused a connection when comparing results.
What affects TTFB
- Network path: distance, congestion and routing between the client, intermediaries and server add latency.
- Connection setup: DNS lookup, TCP establishment and the TLS handshake add time when a new connection is required.
- Server work: slow database queries, overloaded application servers and uncached pages delay the response.
- Intermediaries: a load balancer, proxy or CDN may add processing or reduce TTFB by serving cached content nearby.
TTFB vs latency and page load time
TTFB overlaps with network latency, but it also includes the server’s initial work. It doesn’t measure how long the complete response takes to download.
| Metric | Stops when | Mainly measures |
|---|---|---|
| TTFB | First response byte arrives | Network plus initial server work |
| Latency | A packet reaches its destination or returns | Network delay |
| Page load time | The page finishes loading or becomes usable | TTFB, downloads and rendering |
A page can have low TTFB but load slowly because of large images, limited bandwidth or heavy JavaScript.
Checking TTFB through a proxy
A proxy server adds a client-to-proxy path and must forward the request to the website. Its exit location, connection reuse and load can therefore change TTFB.
curl -sS -o /dev/null -w 'direct: %{time_starttransfer}s\n' https://example.com
curl -sS -o /dev/null -x http://USERNAME:PASSWORD@HOST:PORT -w 'proxy: %{time_starttransfer}s\n' https://example.com
Run several tests and compare medians rather than one sample. Keep the target, HTTP version and connection-reuse policy fixed, and record the proxy’s exit location.
FAQ
What is a good TTFB?
It depends on the endpoint, client location and connection state. Establish a baseline for each region and page type, then investigate consistent increases rather than relying on one universal threshold.
Is TTFB the same as ping?
No. Ping measures network round-trip time using ICMP. TTFB measures an HTTP exchange and includes initial server processing.
Does a proxy always increase TTFB?
No, but a forward proxy often adds some overhead because traffic takes an extra path. A cached response from a reverse proxy or nearby CDN can instead reduce TTFB.