Performance

Time to First Byte (TTFB)

Last updated: April 2026

TTFB measures the time from when the browser sends the HTTP request to when it receives the first byte of the server response. High TTFB delays everything โ€” the browser cannot start rendering until it receives HTML.

Target

Good:              < 800ms
Needs improvement: 800ms - 1800ms
Poor:              > 1800ms

Fix 1 โ€” serve from a CDN

A CDN serves responses from edge nodes close to the user. Moving HTML caching to the edge can reduce TTFB from 500ms to under 50ms for cached pages.

Fix 2 โ€” cache HTML responses at Nginx

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=html_cache:10m;

location / {
    proxy_cache html_cache;
    proxy_cache_valid 200 60s;
    proxy_cache_use_stale updating;
    proxy_pass http://backend;
}

Fix 3 โ€” enable HTTP/2

server {
    listen 443 ssl http2;
    server_name yoursite.com;
}

Fix 4 โ€” reduce database query time

High TTFB on dynamic pages is usually slow database queries. Add query caching, indexes, or use a read replica for public pages.

Measure TTFB

curl -o /dev/null -s -w "TTFB: %{time_starttransfer}s
" https://yoursite.com
📚 HttpFixer Glossary โ€” all terms โ†’