TTFB (Time To First Byte) (TTFB)

Performance

The time from the start of a request to receiving the first byte of the response. Includes DNS, TCP, TLS, and server processing time. A key performance metric—Google recommends under 800ms.

Updated Mar 9, 2026

Full Explanation

TTFB measures everything that happens before content starts arriving: DNS resolution, TCP connection, TLS handshake, request transmission, server processing, and response transmission of the first byte. It's the best single number for "how fast does this feel?"

For cached CDN content, TTFB should be very low—typically 10-50ms from a nearby edge. If you're seeing 200ms+ on cache hits, something's wrong (bad routing, TLS config issues, or you're not actually hitting cache).

For cache misses, TTFB includes the round trip to origin plus origin processing time. This is where origin shields help—they reduce the distance between CDN and origin, cutting miss TTFB. Google's Core Web Vitals flag TTFB over 800ms as "needs improvement" and over 1800ms as "poor."

Examples

# Measure TTFB with curl
$ curl -w 'TTFB: %{time_starttransfer}s\n' -o /dev/null -s https://cdn.example.com/
TTFB: 0.038s  # 38ms - cache hit from local PoP

# Break down the components
$ curl -w 'DNS:     %{time_namelookup}s\nConnect: %{time_connect}s\nTLS:     %{time_appconnect}s\nTTFB:    %{time_starttransfer}s\n' -o /dev/null -s https://cdn.example.com/
DNS:     0.004s
Connect: 0.008s
TLS:     0.015s
TTFB:    0.022s

# Compare cache hit vs miss
# HIT:  TTFB ~20ms (served from edge)
# MISS: TTFB ~180ms (fetched from origin in another continent)

Video Explanation

Frequently Asked Questions

The time from the start of a request to receiving the first byte of the response. Includes DNS, TCP, TLS, and server processing time. A key performance metric—Google recommends under 800ms.

# Measure TTFB with curl
$ curl -w 'TTFB: %{time_starttransfer}s\n' -o /dev/null -s https://cdn.example.com/
TTFB: 0.038s  # 38ms - cache hit from local PoP

# Break down the components
$ curl -w 'DNS:     %{time_namelookup}s\nConnect: %{time_connect}s\nTLS:     %{time_appconnect}s\nTTFB:    %{time_starttransfer}s\n' -o /dev/null -s https://cdn.example.com/
DNS:     0.004s
Connect: 0.008s
TLS:     0.015s
TTFB:    0.022s

# Compare cache hit vs miss
# HIT:  TTFB ~20ms (served from edge)
# MISS: TTFB ~180ms (fetched from origin in another continent)

Related CDN concepts include:

  • Cache Hit Ratio (CHR) — The percentage of requests served from cache versus total requests. A CHR of 95% means …
  • Latency — The time delay between a request and the start of its response. For CDNs, it's …
  • RTT (Round-Trip Time) (RTT) — The time it takes for a packet to travel from client to server and back. …