Skip to main content

Time to First Byte (TTFB)

Time to First Byte (TTFB) measures how long it takes for the browser to receive the first byte after requesting a page. Because every other metric starts after the HTML begins arriving, TTFB is a common root cause behind slow FCP/LCP on WordPress sites.

Quick Summary

If TTFB is 2.5 seconds, the absolute fastest possible LCP score is 2.5 seconds—even with zero images and perfect CSS. TTFB represents the combined sum of DNS resolution, TLS handshaking, PHP execution, and MySQL database querying.

The Metric Baseline

Rating ConstraintAuthorized TTFB TargetDiagnostic Meaning
Good≤ 200msTypically requires effective page caching and/or edge delivery.
Needs Improvement200–600msOften indicates latency or uncached server work.
Poor> 600msCommonly caused by slow backend execution, I/O limits, or overloaded hosting.

Dissecting the Request Lifecycle

Understanding TTFB requires mapping the microscopic events that occur before a single byte of HTML is transmitted.

Stage ProgressionTypical DurationTechnical Description
1. DNS Resolution10–50msTranslating the human domain (example.com) to a physical IP boundary.
2. TCP Handshake20–100msThe network physically establishing a synchronized connection routing.
3. TLS Negotiation50–150msEvaluating encryption certificates (SSL) and securing the channel.
4. Server Execution50–2,000ms+PHP parsing the WordPress core, executing plugins, and querying MySQL.
5. First Byte Transit~1msThe origin hardware transmits the initial HTML headers down the pipe.

Practical takeaway: Stage 4 (server execution) is often the largest and most controllable component for WordPress sites.

Step-by-Step Diagnostic Examples

Calculate TTFB via Terminal

Bypass browser variables entirely and interrogate the server hardware directly:

measure-ttfb.sh
curl -o /dev/null -s -w "TTFB: %{time_starttransfer}\n" https://yourdomain.com

Expected Return Output:

terminal-output.txt
TTFB: 0.183

0.183 seconds (183ms) represents a perfectly functioning caching layer.

Assess TTFB inside Google Chrome

  1. Press F12 to open DevTools, and shift to the Network tab.
  2. Execute a Hard Reload (Ctrl + Shift + R).
  3. Click the absolute first document row (typically your root /).
  4. Select the Timing tab and locate the Waiting for server response metric.

Demonstrate the Value of HTML Caching

cache-comparison.sh
# Request 1: Bypassed Cache (Forces MySQL and PHP generation)
curl -o /dev/null -s -w "TTFB: %{time_starttransfer}\n" https://yourdomain.com
# Output: TTFB: 1.250

# Request 2: Engaging LSCache (Reading flat HTML from origin disk)
curl -o /dev/null -s -w "TTFB: %{time_starttransfer}\n" https://yourdomain.com
# Output: TTFB: 0.085

Practical Scenarios

Shared Hosting Resource Starvation

Problem: Baseline TTFB is ~2.1s on a busy shared host. Fix: Move to a dedicated VPS with better CPU isolation, NVMe storage, and OPcache configured. Result: TTFB improves from ~2.1s to ~250ms.

WooCommerce Administration Bloat

Problem: Uncached visitor TTFB hits 1.2s because rendering the homepage triggers 85 heavy, redundant MySQL product queries simultaneously. Fix: Add Redis object caching and reduce repeated database work. Result: TTFB improves from ~1.2s to ~78ms.

Oceanic Geographic Distance

Problem: An EU-based customer requesting data from a Dallas, Texas origin server faces a harsh 670ms TTFB delay simply due to physical transatlantic cable latency. Fix: Use a CDN (for example Cloudflare APO) to cache and serve HTML closer to users. Result: EU TTFB improves from ~670ms to ~95ms.

Common Mistakes & Troubleshooting

MistakeExplanationSolution
Optimizing images before touching TTFBSmashing a JPEG achieves nothing if the server requires 3 seconds to deliver the DOM.Secure TTFB < 500ms before touching a single frontend asset.
Testing only from the origin serverRunning curl from the VPS shell hides network latency.Test from multiple locations (WebPageTest, or remote curl).
Forgetting logged-in usersPage caching often bypasses authenticated/cart sessions.Add object caching and optimize backend code paths for dynamic sessions.
Cold Cache SyndromePurging the cache deletes the HTML; the immediate next visitor suffers the 2.0s PHP rebuild penalty.Configure a cache crawler to proactively rebuild purged assets.
Redirect ChainsBouncing from http to https to www physically triples the TTFB sequence.Force a single rigid redirect straight to the finalized canonical URL.

Target Quick Reference

TTFB Core Engineering Directives

Target Matrix:

  • Pass Goal: ≤ 200ms

Immediate Optimization Priorities:

  1. Enable heavy full-page caching via LSCache or similar architecture.
  2. Initialize persistent Redis Object Cache for dynamic database shielding.
  3. Configure PHP-FPM workers accurately and enable OPcache deeply.
  4. Delegate global routing to Cloudflare APO Edge networking.
  5. Upgrade to NVMe-backed dedicated or VPS hosting clusters.

Visual TTFB Route

What's Next