Check 06.06 · Performance and Core Web Vitals

Target TTFB ≤ 800 ms as a benchmark

Measure TTFB, break it down into redirects, connection and page generation, then bring it under 800 ms on Apache, Nginx, Cloudflare, AWS or WordPress.

Priority
Important
Difficulty
Intermediate
Estimated time
2 h to 3 days
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

TTFB (Time to First Byte) is the time between the start of navigation and the arrival of the first byte of the response. It is not a Core Web Vital: it is a diagnostic benchmark. Google considers it good at 800 milliseconds or less at the 75th percentile, because beyond that it becomes hard to hold an LCP (Largest Contentful Paint, rendering of the largest visible element) of 2.5 seconds. The task is to find out where this time goes, then to deal with the phase at fault.

Why it matters

The browser can do nothing before it receives the HTML: it can neither discover the CSS nor start downloading the main image. Every millisecond of TTFB is therefore added as is to FCP (First Contentful Paint, first render) and LCP.

TTFB adds up several stages:

  1. any redirects before the final page;
  2. DNS resolution;
  3. opening the connection and the TLS handshake;
  4. sending the request and its passage through the CDN (Content Delivery Network) or proxy;
  5. generating the response in the application: code, database, calls to external services.

Stages 1 to 4 depend on the network and on distance; stage 5 depends on your code and your cache. On a dynamic site without a page cache, it is almost always the one that dominates.

For crawlers, a slow server reduces the crawl rate: Google adjusts its pace to the response times it observes.

What it improves

  • LCP and FCP A direct effect, millisecond for millisecond.
  • Crawling A server that responds quickly gets crawled more. The effect is only noticeable on large sites.
  • Server capacity A page served from a cache costs far less CPU than a generated page, which protects the site during traffic peaks.
  • Rankings No effect of its own. TTFB is not a Core Web Vital; it only counts through LCP.

How to check

Measure the stages with curl:

curl -s -o /dev/null -w "DNS: %{time_namelookup} s\nConnect: %{time_connect} s\nTLS: %{time_appconnect} s\nFirst byte: %{time_starttransfer} s\nRedirects: %{num_redirects}\n" -L https://example.com/

The times are cumulative from the start. Page generation roughly corresponds to the difference between “First byte” and “TLS”. Run the command several times: the first call may hit a cold cache.

This measurement starts from your own machine. For what visitors experience:

Compliant result: field p75 of 800 ms or less. When measuring directly from a fast network close to the server, aim much lower: your visitors' mobile network will add its share.

How to implement

Step 1 — Break down TTFB

Slow phase Clue Lever
Redirects num_redirects above 0 Link to and serve the final URL directly
DNS High time_namelookup Faster DNS provider, longer TTL
Connection and TLS Large gap between DNS and TLS CDN, HTTP/3, TLS 1.3, server closer to visitors
Generation Large gap between TLS and first byte Page cache, application optimization

Also compare a dynamic page with a static file on the same server (an image, the robots.txt). If the static file responds quickly and the page slowly, the problem lies in the application, not in the network.

Remove redirects before the page

Each redirect adds a full round trip, sometimes a new connection. Point internal links, sitemaps, campaigns and canonical tags to the final URL (HTTPS, correct subdomain, consistent trailing slash). See fix redirect chains (opens in a new tab) and configure HSTS (opens in a new tab), which spares returning visitors the HTTP to HTTPS redirect.

Cache pages

This is the most powerful lever: a page served from a cache costs neither PHP nor database work. Apply browser and server cache configuration (opens in a new tab), first on the server, then at the CDN edge if your audience is spread out.

Bring the connection closer and make it faster

Host the site in your visitors' region, enable HTTP/2 and HTTP/3, TLS 1.3 and persistent connections: see optimize hosting and CDN (opens in a new tab).

Speed up page generation

When a page cannot be cached (cart, account, search), it has to be generated faster:

  • use a recent version of the language and enable the code cache (OPcache for PHP);
  • reduce and index queries: optimize database queries (opens in a new tab);
  • cache expensive fragments and results in Redis or Memcached;
  • move everything that can wait out of the request: sending emails, calls to third-party APIs, image processing.

Production OPcache settings, in php.ini or a file in conf.d:

opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0

With validate_timestamps=0, PHP no longer rereads modified files: reload PHP-FPM on every deployment (sudo systemctl reload php8.4-fpm, adapted to your version). Keep the default value if you edit files directly on the server.

Measure on the server side with Server-Timing

The Server-Timing header exposes the duration of internal stages in the browser's DevTools:

header('Server-Timing: db;dur=53.2;desc="Database", app;dur=120.4;desc="Application"');

Do not expose sensitive information in it in production.

Apache

Versions Apache 2.4.17 and later (HTTP/2 via mod_http2).

Log the processing time of each request to spot slow URLs. %D is expressed in microseconds.

LogFormat "%h %l %u %t \"%r\" %>s %b %D" avec_duree
CustomLog ${APACHE_LOG_DIR}/access_duree.log avec_duree

Protocols h2 http/1.1
KeepAlive On

Run PHP with PHP-FPM and the mpm_event module rather than with mod_php and mpm_prefork: this is also a requirement for HTTP/2. Reload with sudo apachectl configtest && sudo systemctl reload apache2.

Nginx

Versions Nginx 1.18 and later.

In the http context:

log_format duree '$remote_addr [$time_local] "$request" $status '
                 'rt=$request_time urt=$upstream_response_time cache=$upstream_cache_status';
access_log /var/log/nginx/access_duree.log duree;

urt is the time spent in PHP-FPM or the application: if it accounts for most of rt, look at the application. To list the slowest URLs, see analyze server logs (opens in a new tab). Reload with sudo nginx -t && sudo systemctl reload nginx.

Cloudflare

Versions Cloudflare dashboard, all plans, November 2026.

By default, Cloudflare does not cache HTML: the cf-cache-status: DYNAMIC header on the page means that every visit goes all the way back to your server. Create a cache rule for public HTML (see the check on caching), then enable Tiered Cache in the Caching section, with the “Smart” topology, so that Cloudflare's data centers serve each other before calling on the origin. Finally, check that HTTP/3 is enabled under Speed > Settings > Protocol Optimization.

AWS

Versions Amazon CloudFront, RDS and Lambda consoles, November 2026.

  • Put CloudFront in front of the origin (ALB, EC2, S3) and cache whatever can be cached.
  • Host the application and the RDS database in the same region, close to your visitors.
  • Enable HTTP/3 in the distribution settings, from the CloudFront console.
  • On Lambda, cold starts lengthen the TTFB of the first requests: provisioned concurrency eliminates them, at a fixed cost.

Plesk

Versions Plesk Obsidian 18.0.

In Websites & Domains > your domain > PHP Settings, choose the most recent PHP version compatible with your site and the “FPM application served by nginx” handler, which avoids going through Apache. Check on the same page that opcache.enable is on.

cPanel

Versions cPanel & WHM 94 and later.

Software section: “MultiPHP Manager” (or “Select PHP Version” on CloudLinux servers) to switch to a recent PHP version and enable PHP-FPM if the host allows it; “MultiPHP INI Editor” for the settings. Check that OPcache is among the enabled extensions.

Shared hosting

Your levers are limited: PHP version in the control panel, OPcache, page cache at the CMS level, a free CDN in front of the site. If the TTFB of a static file is already poor or varies widely depending on the time of day, the server is overloaded: change plan or host.

WordPress

Versions WordPress 6.1 to 7.1.

  1. Tools > Site Health flags a missing page cache, a high server response time and the lack of a persistent object cache.
  2. Install a page cache: this is the main gain.
  3. Enable a persistent object cache (Redis or Memcached) if the host offers one: it relieves uncached pages, including the cart and the admin.
  4. Temporarily install the Query Monitor plugin to identify slow queries and plugins, then remove unnecessary plugins (opens in a new tab).

Shopify

Versions Shopify admin, all plans, November 2026.

The infrastructure is managed by Shopify. What depends on you: the complexity of the Liquid code (nested loops over large collections, many section calls) and apps that run on the server side. The Shopify Theme Inspector for Chrome extension measures Liquid render time line by line.

Laravel

Versions Laravel 10 to 13.

Enable OPcache, fix N+1 queries with eager loading (with()), cache expensive data with Cache::remember() and push slow processing into a queue. Laravel Octane keeps the application in memory between requests and removes the framework's boot cost.

Laravel 11 to 13

On deployment, cache the configuration, routes, views and events with a single command:

php artisan optimize

Laravel 10

The optimize command does not yet cache views or events: run the four commands on deployment.

php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan event:cache

Next.js

Versions Next.js 15 and 16 (App Router).

Place functions in the same region as the database and use streaming with Suspense to send the start of the HTML without waiting for slow data.

Next.js 16 with Cache Components

With cacheComponents: true in next.config.ts, data is dynamic by default: mark the pages, components or functions that can be cached with the 'use cache' directive. Next.js prerenders a static HTML shell served immediately, then streams the dynamic parts placed inside Suspense boundaries.

Next.js 15, or 16 without Cache Components

A static or periodically regenerated (ISR) page is served from a cache; a dynamically rendered page waits for its data. Make everything that can be static, static.

Common mistakes

  • Measuring from the office, on fiber, next to the server: your mobile visitors are elsewhere.
  • Measuring only the cached page: also measure an uncached page and a cold cache.
  • Setting up a CDN without caching HTML: static files get faster, the page's TTFB does not change.
  • Treating 800 ms as an official ranking threshold: it is a benchmark. A TTFB of 900 ms with an LCP of 2 s is no problem at all.
  • Forgetting redirects: http to https then to www costs two round trips before the first line of HTML.
  • Calling an external API while generating the page: its response time becomes yours.
  • Purging the whole cache on every change: the following visits pay for regeneration. Purge selectively.

Frequently asked questions

Is TTFB a Core Web Vital?

No. TTFB, the time until the first byte of the response, is a diagnostic benchmark, not a Core Web Vital. Google considers it good at 800 milliseconds or less at the 75th percentile, because beyond that it becomes hard to hold an LCP of 2.5 seconds. It only counts through LCP: a TTFB of 900 ms with an LCP of 2 seconds is no problem at all.

How do I measure a page's TTFB?

With curl and its -w option, which displays DNS resolution, connection, TLS handshake and first byte times: page generation roughly corresponds to the gap between TLS and first byte. Run the command several times, on a cached page and on an uncached one. For what visitors experience, check the field TTFB at the 75th percentile in PageSpeed Insights or CrUX.

What lengthens TTFB the most?

On a dynamic site without a page cache, it is almost always the generation of the response by the application: code, database queries, calls to external services. Next come redirects before the final page, each of which adds a full round trip, then the distance to the server and the connection handshake. The page cache remains the most powerful lever.

Does a slow server hurt crawling by Google?

Yes. Google adjusts its crawl rate to the response times it observes: a slow server is crawled more slowly, while a fast and stable server gets crawled more. The effect is only really noticeable on large sites. For rankings, TTFB has no effect of its own: it only acts through LCP, millisecond for millisecond.

Updated on

Topic checklist (PDF)

And now?

In the “Performance and Core Web Vitals” topic

  1. Analyze PageSpeed Insights and Lighthouse
  2. Analyze real-user CrUX data
  3. Target LCP ≤ 2.5 s at the 75th percentile
  4. Target INP ≤ 200 ms at the 75th percentile
  5. Target CLS ≤ 0.1 at the 75th percentile
  6. Target TTFB ≤ 800 ms as a benchmark
  7. Optimize hosting and CDN
  8. Enable Brotli/Gzip
  9. Configure browser and server caching
  10. Minify CSS and JavaScript
  11. Remove unused CSS/JS
  12. Reduce render-blocking resources
  13. Defer non-essential scripts
  14. Limit third-party scripts
  15. Optimize database queries
  16. Optimize fonts (WOFF2, font-display)
  17. Preload only critical resources
  18. Optimize the LCP image without lazy loading
  19. Lazy-load offscreen content
  20. Reserve space for media and ads
  21. Reduce DOM complexity
  22. Test before and after cookie consent
  23. Test on a slow mobile connection
  24. Set a performance budget
  25. Preload likely navigations with Speculation Rules
  26. Make pages eligible for the back/forward cache (bfcache)
  27. Diagnose INP with Long Animation Frames (LoAF)