Skip to content
GDPR compliant. Hosted in DE.
14-day free trial →
TTFB OptimizationServer Performance
Performance 14 min read 16 Jan 2026

Optimize Server Response Time (TTFB): The Complete Guide

Time to First Byte determines your website's baseline speed. This guide covers every lever from DNS to caching to database optimization for achieving TTFB under 200 ms.

X

XICTRAQ Team

XICTRAQ

PerformanceTTFBServerHostingCachingOptimization
200ms
Optimal TTFB (Google)
680ms
German average (HTTP Archive)
70-90%
TTFB reduction through caching
TTFB Breakdown: From Request to First Byte Request Phases (Total: 162ms) Target: < 200ms DNS LookupDNS resolution before connect23msTCP Connect3-Way-Handshake18msTLS HandshakeCertificate + key exchange32msServer ProcessingDB-Queries + Render89msFirst BytePayload-StartOK200ms TTFB by region (p95) Frankfurt (DE) 89ms London (UK) 112ms New York (US) 240ms Tokyo (JP) 420ms Solution: CDN (Cloudflare) cuts remote TTFB by 60-80% Benchmark Good < 200ms Needs improvement 200-800ms Poor > 800ms XICTRAQ measures all 5 phases
Time to First Byte (TTFB) is the time span from sending a browser request to receiving the first response byte from the server. This metric determines your entire website's baseline speed: no LCP value can be better than the TTFB plus rendering time. According to HTTP Archive, the average TTFB of German websites is 680 milliseconds (HTTP Archive), while Google considers values under 200 milliseconds optimal. This means most websites waste more than 400 milliseconds before the browser can even begin rendering. This guide explains each phase of the TTFB, shows the most common causes of high values, and provides concrete solutions for each phase.

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.

Enable OCSP Stapling

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.

Full-Page Cache (Varnish)

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.

Object Cache (Redis)

Redis stores individual database queries and computed objects in memory. Ideal for CMS systems that execute dozens of database queries per page load.

Opcode Cache (OPcache)

PHP OPcache stores compiled PHP bytecode and eliminates repeated compilation. Reduces PHP execution time by 50 to 70% without code changes.

CDN Edge Cache

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.

  1. Enable slow query log: Identify queries taking longer than 100 milliseconds. These are the first candidates for optimization.
  2. 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.
  3. 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.
  4. Implement query caching: Frequently executed queries with stable results should be cached in Redis or Memcached.
  5. Use connection pooling: Every new database connection costs 5 to 15 milliseconds. Connection pooling keeps connections open and eliminates this overhead.
  6. 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 TypeTypical TTFBSuitable ForCost/Month
Shared Hosting600-1,500 msHobby projectsEUR 3-10
Managed WordPress200-500 msBlogs, small shopsEUR 15-50
VPS / Cloud Server100-300 msSMB websitesEUR 20-80
Managed Cloud Hosting50-150 msBusiness-critical sitesEUR 50-200
Dedicated Server30-100 msHigh-traffic, enterpriseEUR 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 http2 in the server configuration.
  • sendfile and tcp_nopush: These nginx directives optimize static file delivery by using kernel functions instead of user-space copies.
Optimized nginx configuration
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

  1. Measure current TTFB and review phase breakdown
  2. Set up server-side full-page caching (Varnish or nginx FastCGI Cache)
  3. Activate object cache with Redis or Memcached
  4. Optimize database queries (indexes, eliminate N+1, query cache)
  5. Configure CDN with edge caching for static and dynamic content
  6. Activate TLS 1.3 and OCSP Stapling
  7. Enable HTTP/2 or HTTP/3 on the web server
  8. Evaluate hosting and upgrade to VPS or managed hosting if needed
  9. Enable compression (Brotli/Gzip) for all text-based responses
  10. 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?
Google recommends a TTFB under 800 milliseconds, with values under 200 milliseconds considered optimal. The top 10% of websites achieve TTFB values under 100 milliseconds. With server-side caching and a CDN, this is achievable for most websites.
Is TTFB a Google ranking factor?
TTFB is not a direct ranking factor but influences the LCP value, which is an official Core Web Vital and thus a ranking factor. A high TTFB makes it practically impossible to meet the LCP threshold of 2.5 seconds.
Why does my TTFB fluctuate so much?
TTFB fluctuations are normal and depend on server load, cache status, database activity, and network conditions. Large fluctuations (over 200 milliseconds) indicate problems: missing caches, overloaded servers, or unstable hosting infrastructure.
Does a CDN help with TTFB reduction?
Yes, a CDN improves TTFB through shorter network paths (edge servers near the user) and edge caching that eliminates server processing. For DACH visitors, a CDN can reduce TTFB by 50 to 70%, especially when the origin server is not in the region.
What does TTFB optimization cost?
Most measures are free or inexpensive: caching configuration, database indexes, compression, and HTTP/2 require only configuration changes. A hosting upgrade to VPS or managed hosting typically costs EUR 20 to 80 per month but pays for itself through better conversion rates.
How do I measure my website's TTFB?
Chrome DevTools (Network Tab) shows the TTFB for individual requests. For a complete phase breakdown, use WebPageTest or XICTRAQ, which measures TTFB continuously from multiple locations and alerts you to deterioration.
Sources

This article is based on data from: (Aberdeen Group), (Akamai), Core Web Vitals (Google), (HTTP Archive).

Related in XICTRAQ

Start in 60 seconds

Let XICTRAQ watch your website.

Permanent free plan available. No credit card, no installation, no hidden fees.