Time to First Byte (TTFB) Budget and Optimization

Set and track Time to First Byte budgets. Understand how TTFB impacts all other performance metrics and strategies for reducing server response time including CDN, caching, and edge computing.

Timing Metrics

Detailed Explanation

TTFB Performance Budgets

Time to First Byte (TTFB) measures the time from when the browser sends a request to when it receives the first byte of the response. It is the foundation metric — every other timing metric (FCP, LCP, TTI) is delayed by a slow TTFB.

TTFB Thresholds

Rating TTFB
Good < 800 ms
OK < 1800 ms
Poor > 1800 ms

Budget Recommendations

Architecture TTFB Target
Static site (CDN) < 100 ms
SSG + CDN < 200 ms
SSR + CDN < 400 ms
SSR (no CDN) < 600 ms
Dynamic (API) < 800 ms

What Contributes to TTFB

TTFB = DNS lookup + TCP connection + TLS handshake + Server processing + Network latency

Each component adds time:

  • DNS lookup: 20-120 ms (cached vs uncached)
  • TCP connection: 50-200 ms (depends on distance)
  • TLS handshake: 50-150 ms (TLS 1.3 vs 1.2)
  • Server processing: 50-500+ ms (database queries, rendering)
  • Network latency: varies by geography

Optimization Strategies

  1. CDN — Serve from edge locations close to users (reduces network latency and TCP/TLS time)
  2. HTTP/2 or HTTP/3 — Connection reuse reduces overhead for subsequent requests
  3. Server-side caching — Cache database queries, rendered HTML, API responses
  4. Edge computing — Run server logic at CDN edge nodes (Cloudflare Workers, Vercel Edge)
  5. Database optimization — Index queries, connection pooling, read replicas
  6. Preconnect — Use <link rel="preconnect"> for third-party origins

TTFB and the Budget Tracker

Set your TTFB target in the timing budgets section. While the tracker does not measure actual TTFB (that requires a live server), having the target documented alongside resource budgets ensures the team considers server performance as part of the overall performance budget.

Use Case

TTFB budgets are critical for server-rendered applications and sites with dynamic content. An e-commerce site with a 2-second TTFB cannot possibly achieve a 2.5-second LCP — there is only 500 ms left for resource loading and rendering. Setting a TTFB budget forces the team to invest in server-side performance alongside frontend optimization.

Try It — Performance Budget Tracker

Open full tool