What TTFB Measures and Why It Matters
TTFB is not an official Core Web Vital, but it forms the foundation for LCP, INP, and thus the entire user experience. Google explicitly recommended in 2023 keeping TTFB under 800 milliseconds, with values under 200 milliseconds considered optimal (Google). The reason is simple: everything the browser displays must first be delivered by the server. A TTFB of 800 milliseconds means the browser waits nearly a second before it can even begin parsing the HTML.
The impact on Core Web Vitals is directly measurable: a TTFB reduction of 500 milliseconds improves LCP by at least 500 milliseconds, often more, because the browser can begin loading dependent resources sooner. For websites that miss the LCP threshold of 2.5 seconds, TTFB optimization is therefore often the most effective first step.
The Five Phases of TTFB in Detail
TTFB consists of several sequential network and server phases. To optimize effectively, you need to understand which phase accounts for the largest share of total time. The waterfall visualization above shows an optimized example with 162 milliseconds total time.
Phase 1: DNS Lookup
Before the browser can establish a connection, it must resolve the domain name to an IP address. This DNS lookup typically takes 10 to 50 milliseconds but can exceed 200 milliseconds with poor DNS providers or insufficient cache utilization. DNS queries are cached at multiple levels: in the browser, operating system, router, and ISP. Only the first query after TTL expiration requires a full resolution.
- Choose a fast DNS provider: Premium DNS services respond in under 15 milliseconds worldwide. Switching from a standard DNS to a specialized provider can shorten DNS lookup by 50-100 milliseconds.
- Use DNS prefetching: The tag
<link rel="dns-prefetch" href="//cdn.example.com">instructs the browser to perform DNS resolution for external domains in advance. - Optimize DNS TTL: A TTL of 300 to 3,600 seconds offers a good balance between change flexibility and cache efficiency.
Phase 2: TCP Connection Establishment
The TCP three-way handshake (SYN, SYN-ACK, ACK) takes one round-trip between browser and server. With a server in Frankfurt and a user in Munich, that is typically 10 to 20 milliseconds. With a server in the US and a German user, it can exceed 100 milliseconds. Physical distance is the decisive factor here.
HTTP/2 and HTTP/3 significantly reduce TCP overhead. HTTP/2 multiplexes all requests over a single TCP connection, so the handshake occurs only once. HTTP/3 completely replaces TCP with QUIC, combining connection establishment and encryption in a single round-trip. Switching to HTTP/3 can bring particularly large improvements for mobile users with unstable connections.
Phase 3: TLS Handshake
The encryption negotiation for HTTPS connections requires at least one additional round-trip. TLS 1.2 requires two round-trips, TLS 1.3 only one. Since HTTPS is standard for all modern websites, migrating to TLS 1.3 is particularly worthwhile. Most modern web servers already support TLS 1.3; it simply needs to be enabled in the configuration.
OCSP Stapling prevents the browser from needing to send a separate request to the certificate authority to verify SSL certificate validity. This saves another round-trip and noticeably speeds up the TLS handshake. XICTRAQ's SSL monitoring automatically checks whether OCSP Stapling is correctly configured.
Phase 4: Server Processing
Server processing time is usually the longest and most controllable phase of TTFB. It encompasses everything happening on the server: request routing, authentication, database queries, template rendering, and response generation. For an unconfigured WordPress installation with 30 plugins, this phase alone can take 500 milliseconds to 2 seconds.
Server processing time depends on three factors: application complexity, available server hardware, and code efficiency. All three can be optimized, with the greatest leverage almost always lying in caching.
Phase 5: Response Generation and First Byte
After the server has calculated the response, it must send the first byte of the HTTP response back to the browser. This final step is minimal with correct configuration (a few milliseconds) but can be delayed by missing compression, oversized response headers, or output buffering. Enable Brotli compression for all text-based responses and minimize response headers to essentials.
Server-Side Caching: The Most Effective Measure
Caching is by far the most effective method for TTFB reduction. Instead of running the entire processing chain for every page view, the finished HTML response is held in memory and served directly. TTFB drops from typically 500 to 1,000 milliseconds to 20 to 50 milliseconds.
Varnish is an HTTP reverse proxy that holds complete HTML pages in memory. For dynamic pages, Varnish supports Edge Side Includes (ESI) for partially dynamic caching.
Redis stores individual database queries and computed objects in memory. Ideal for CMS systems that execute dozens of database queries per page load.
PHP OPcache stores compiled PHP bytecode and eliminates repeated compilation. Reduces PHP execution time by 50 to 70% without code changes.
A CDN caches HTML pages and assets at edge locations worldwide. For DACH visitors, this means delivery from a regional server instead of a distant data center.
Handling Cache Invalidation Correctly
The biggest challenge with caching is invalidation: when should the cache be cleared so changes become visible? Too aggressive invalidation reduces cache hit rate and thus performance gains. Too infrequent invalidation shows outdated content. The proven strategy is event-based invalidation: the cache is cleared only when content actually changes, for example when publishing a new blog post or updating a product page.
Database Optimization for Faster Responses
Database queries are frequently the biggest time consumer in the server processing phase for dynamic websites. A single complex query can take 200 to 500 milliseconds, and CMS systems typically execute 20 to 100 queries per page load. The sum of these queries significantly determines the TTFB.
- Enable slow query log: Identify queries taking longer than 100 milliseconds. These are the first candidates for optimization.
- Check and create indexes: Missing indexes on frequently queried columns are the most common cause of slow queries. A proper index can accelerate a query from 500 milliseconds to 5 milliseconds.
- Eliminate N+1 queries: This anti-pattern executes a separate query for each record instead of loading everything in a join. ORMs like Eloquent or Doctrine offer eager loading as a solution.
- Implement query caching: Frequently executed queries with stable results should be cached in Redis or Memcached.
- Use connection pooling: Every new database connection costs 5 to 15 milliseconds. Connection pooling keeps connections open and eliminates this overhead.
- Perform database maintenance: Regular OPTIMIZE TABLE for MySQL or VACUUM for PostgreSQL prevents fragmentation and keeps query performance stable.
Hosting Infrastructure: The Hardware Foundation
No amount of good code can compensate for poor hardware limitations. Shared hosting divides CPU, RAM, and I/O capacity among dozens of other websites. When a neighboring account runs a CPU-intensive task, your TTFB suffers. For business-critical websites, upgrading to more dedicated resources is almost always the more economical path.
| Hosting Type | Typical TTFB | Suitable For | Cost/Month |
|---|---|---|---|
| Shared Hosting | 600-1,500 ms | Hobby projects | EUR 3-10 |
| Managed WordPress | 200-500 ms | Blogs, small shops | EUR 15-50 |
| VPS / Cloud Server | 100-300 ms | SMB websites | EUR 20-80 |
| Managed Cloud Hosting | 50-150 ms | Business-critical sites | EUR 50-200 |
| Dedicated Server | 30-100 ms | High-traffic, enterprise | EUR 100-500 |
The investment in better hosting pays for itself through improved conversion rates, higher rankings, and lower bounce rates. For an online shop with EUR 500,000 annual revenue, a TTFB improvement from 800 to 200 milliseconds through better hosting can drive a 3 to 5% revenue increase (Aberdeen Group). The hosting uptime comparison covers additional aspects of hosting selection.
CDN Configuration for Optimal TTFB
A Content Delivery Network reduces TTFB through two mechanisms: it shortens the physical distance between user and server (lower latency) and caches content at the edge (less server processing). For a website with a DACH audience, a CDN means visitors from Vienna, Zurich, and Hamburg each receive content from a nearby edge server. According to Akamai, a CDN can reduce load times by 50% or more (Akamai).
CDN configuration determines the actual performance gain. Cache TTLs that are too short lead to unnecessarily many origin requests. TTLs that are too long delay content updates. The optimal strategy depends on content type: static assets like images, CSS, and JavaScript should be cached with long TTLs (1 year) and content hashing. HTML pages can be cached with shorter TTLs (5 to 60 minutes) and invalidated event-based when changes occur.
Web Server Configuration: nginx, Apache, and Caddy
Web server configuration has a direct impact on TTFB. Missing compression, suboptimal worker configuration, and missing keep-alive settings unnecessarily worsen response times. The following optimizations apply to all common web servers.
- Enable compression: Brotli for static content (pre-compressed at build time), Gzip for dynamic responses. Reduces transfer size by 60-80%.
- Configure keep-alive: Keeps TCP connections open for follow-up requests and avoids repeated handshakes. A timeout of 60-120 seconds is optimal for most applications.
- Adjust worker processes: The number of workers should match the number of CPU cores. Too few workers create queues; too many cause context-switching overhead.
- Enable HTTP/2: Multiplexing over a single connection. In nginx, configured with
listen 443 ssl http2in the server configuration. - sendfile and tcp_nopush: These nginx directives optimize static file delivery by using kernel functions instead of user-space copies.
server {
listen 443 ssl http2;
# Brotli compression
brotli on;
brotli_comp_level 6;
brotli_types text/html text/css application/javascript application/json image/svg+xml;
# Gzip fallback
gzip on;
gzip_comp_level 6;
gzip_types text/html text/css application/javascript application/json;
# Keep-Alive
keepalive_timeout 120;
keepalive_requests 1000;
# Long cache for static assets
location ~* \.(css|js|png|jpg|webp|avif|woff2)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Prioritize TLS 1.3
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
# OCSP Stapling
ssl_stapling on;
ssl_stapling_verify on;
}CMS-Specific Optimizations
Content management systems are the most common cause of high TTFB values because they run through a chain of database queries, plugin hooks, and template rendering with every page load. Optimization depends heavily on the CMS in use.
WordPress: From 800 ms to 100 ms
WordPress executes 50 to 200 database queries during a typical page load and loads 20 to 40 plugin files. Without caching, this results in TTFB values of 500 to 1,500 milliseconds. The most effective measure is a full-page cache that drops TTFB below 100 milliseconds. Additionally, you should limit plugin count to essentials, activate object cache via Redis, enable PHP OPcache and JIT compilation, and use PHP 8.2 or newer.
Shopware and Other E-Commerce Systems
E-commerce systems are particularly susceptible to high TTFB values because product pages, categories, and the shopping cart require dynamic data. Shopware CE benefits from HTTP cache, OpenSearch for product search, and Redis as session storage. Product catalog pages should be cached aggressively while cart and checkout pages must remain dynamic.
Measuring and Monitoring TTFB
A one-time TTFB measurement shows only a snapshot. TTFB fluctuates depending on time of day, server load, cache status, and network conditions. Only continuous monitoring shows the actual state and detects deterioration early.
- Chrome DevTools (Network Tab): Shows the TTFB for each individual request. Useful for single analyses but not for long-term monitoring.
- WebPageTest: Detailed waterfall analysis with TTFB breakdown by DNS, TCP, TLS, and server processing. Can test from various locations.
- XICTRAQ Performance Monitoring: Automated measurement from multiple DACH locations with trend analysis and alerting on deterioration. Shows TTFB breakdown by phases.
- Navigation Timing API: Browser-side TTFB measurement for Real User Monitoring. XICTRAQ's cookieless analytics use this API for GDPR-compliant field data.
Checklist: Bringing TTFB Below 200 ms
- Measure current TTFB and review phase breakdown
- Set up server-side full-page caching (Varnish or nginx FastCGI Cache)
- Activate object cache with Redis or Memcached
- Optimize database queries (indexes, eliminate N+1, query cache)
- Configure CDN with edge caching for static and dynamic content
- Activate TLS 1.3 and OCSP Stapling
- Enable HTTP/2 or HTTP/3 on the web server
- Evaluate hosting and upgrade to VPS or managed hosting if needed
- Enable compression (Brotli/Gzip) for all text-based responses
- Set up continuous TTFB monitoring with XICTRAQ
Why Continuous Monitoring Is Indispensable
TTFB values change constantly. A CMS update can alter database queries, a new plugin can increase server processing time, and a hosting provider can redistribute server resources. Without continuous monitoring, you will not notice these deteriorations until users bounce or rankings decline.
XICTRAQ measures your website's TTFB around the clock from multiple locations and breaks down the measurement into DNS, TCP, TLS, and server processing. Combined with security scans, SEO monitoring, and GDPR compliance checks, you get a complete picture of website health. Start with a free demo or register directly.
What is a good TTFB value?
Is TTFB a Google ranking factor?
Why does my TTFB fluctuate so much?
Does a CDN help with TTFB reduction?
What does TTFB optimization cost?
How do I measure my website's TTFB?
This article is based on data from: (Aberdeen Group), (Akamai), Core Web Vitals (Google), (HTTP Archive).