← Back to Course Index

Module 2.5 — Server & Delivery: TTFB, Caching, CDN, HTTP/2 & HTTP/3, Compression

Performance engineering is not just about what you send to the browser — it is equally about how fast you send it and from where. This module covers the server and delivery layer: the infrastructure decisions that set a hard floor on how fast your pages can ever be. No amount of image optimisation or code splitting can compensate for a slow server or a misconfigured cache.

By the end of this module you will be able to diagnose TTFB problems, design a layered caching strategy, understand what a CDN actually does for SEO, and read protocol-level details in DevTools that reveal real delivery bottlenecks.


1. Why the Delivery Layer Is an SEO Variable

Every Core Web Vitals metric starts at the server. LCP cannot be fast if the browser is still waiting for the first byte of HTML. INP is worsened when scripts load slowly because of high latency. CLS is less predictable when resources arrive in inconsistent order due to network variance.

Googlebot also has crawl timeouts. If your server responds slowly, the render queue backs up, rendering is delayed, and indexed content can lag by days or weeks. Google has publicly acknowledged that TTFB is not a direct ranking signal, but it is the upstream dependency of every signal that is.


2. Time to First Byte (TTFB)

2.1 What TTFB Measures

TTFB is the time from a browser or crawler sending an HTTP request to receiving the first byte of the response body. It encompasses:

A good TTFB target is under 800 ms as measured in the field (CrUX). Under 200 ms is excellent. Over 1800 ms is considered poor by Lighthouse/PageSpeed Insights.

2.2 Reading TTFB in Chrome DevTools

Open DevTools → Network tab → click the main document request → select the Timing sub-tab. You will see a waterfall broken into phases:

Queued
Stalled
DNS Lookup          ← network/DNS problem if high
Initial connection  ← TCP + TLS problem if high
Waiting (TTFB)      ← server processing problem if high
Content Download    ← response size problem if high

The Waiting (TTFB) row isolates the server processing contribution from the network contribution. If TTFB is 600 ms but Initial connection is 400 ms, your server is actually fast — the latency is physical distance, cured by a CDN.

2.3 Common TTFB Causes and Fixes


3. Caching Architecture

Caching is the practice of storing a computed or fetched response so it can be served again without recomputing it. There are multiple caching layers and each one has different properties, lifetime, and invalidation control.

3.1 The Caching Layers (from closest to furthest from the user)

3.2 HTTP Cache-Control Headers

Cache-Control is the primary mechanism for communicating caching policy from server to browser and CDN. Key directives:

Cache-Control: public, max-age=31536000, immutable

3.3 Cache Validation: ETag and Last-Modified

When a cached response expires, the browser sends a conditional request. If the server confirms the content has not changed, it returns a 304 Not Modified with no body — saving bandwidth without a full round-trip. This is controlled by:

ETag: "abc123xyz"
Last-Modified: Tue, 01 Jul 2025 08:00:00 GMT

The browser sends If-None-Match: "abc123xyz" or If-Modified-Since: ... and the server decides whether to send a full response or a 304.

3.4 Cache Invalidation Strategy

The hard problem in caching is not storing — it is knowing when to expire. Two main strategies:


4. Content Delivery Networks (CDNs)

4.1 How a CDN Works

A CDN is a geographically distributed network of Points of Presence (PoPs) — each PoP is a cluster of servers in a data centre. When a user requests your URL, DNS routes them to the nearest PoP. If the PoP has the response cached (cache HIT), it serves it immediately, typically in single-digit milliseconds of latency. If it does not (cache MISS), it fetches from your origin server, caches it, and serves it — adding only the single origin round-trip as overhead.

For SEO, the critical insight is that Googlebot crawls from Google's own infrastructure (primarily US-based), but real users — and therefore real CrUX field data — come from everywhere. A CDN improves field data TTFB globally, which feeds into the Page Experience signal.

4.2 CDN Edge Caching vs Origin

By default, most CDNs respect your origin's Cache-Control headers and cache accordingly. However, you can configure CDN-level rules that override or supplement them:

4.3 CDN SEO Considerations


5. HTTP/2 and HTTP/3

5.1 HTTP/1.1 and Its Bottlenecks

The original HTTP/1.1 protocol was designed in 1997. Its fundamental limitation for modern pages is head-of-line blocking: only one request can be in flight per TCP connection at a time (browsers partially work around this by opening 6–8 parallel connections per origin, but that is a workaround, not a solution). Loading 30 assets from one origin with HTTP/1.1 is genuinely slow.

5.2 HTTP/2 — What Changes

HTTP/2 (standardised 2015) introduced several fundamental improvements:

HTTP/2 requires HTTPS. Practically, this means that HTTPS is no longer just a security and ranking signal — it is also a prerequisite for protocol-level performance.

5.3 HTTP/3 — QUIC Transport

HTTP/3 replaces the TCP transport layer with QUIC, a UDP-based protocol designed by Google. The motivation is that HTTP/2 multiplexing eliminated application-layer head-of-line blocking, but TCP-level head-of-line blocking remained: a lost packet blocks all streams on that TCP connection.

QUIC benefits:

HTTP/3 is now supported by all major browsers and CDNs. Google itself serves from HTTP/3. Enabling it at your CDN is typically a single checkbox.

5.4 Checking Protocol Version in DevTools

In Chrome DevTools → Network tab, right-click the column headers and add the Protocol column. You will see values like:

h2        ← HTTP/2
h3        ← HTTP/3 (QUIC)
http/1.1  ← Legacy — investigate why

If critical resources (your HTML document, main CSS, main JS) are still served over HTTP/1.1, that is a flag. It usually means the resource is being served from a different origin that has not upgraded, or your CDN/server has not enabled HTTP/2 or HTTP/3.


6. Compression: Brotli and Gzip

6.1 How Transfer Compression Works

The server compresses the response body before sending it, and the browser decompresses it on arrival. The client advertises its supported compression algorithms in the request header:

Accept-Encoding: gzip, deflate, br

The server responds with the encoding it chose:

Content-Encoding: br

6.2 Gzip

Gzip (GNU zip) is the longstanding standard, supported universally. For HTML, CSS, and JS, it typically achieves 60–80% size reduction. Configuration in Nginx:

gzip on;
gzip_types text/html text/css application/javascript application/json image/svg+xml;
gzip_min_length 1024;
gzip_comp_level 6;

6.3 Brotli

Brotli (developed by Google, standardised 2016) uses a different algorithm optimised for web content. It achieves 15–25% better compression than gzip at comparable CPU cost for typical HTML/CSS/JS files. At higher compression levels it is slower to compress (suitable for pre-compressing static assets at build time) but equally fast to decompress.

Brotli is supported by all modern browsers. The browser signals support via br in Accept-Encoding. Nginx with the ngx_brotli module:

brotli on;
brotli_types text/html text/css application/javascript application/json image/svg+xml;
brotli_comp_level 6;

For static assets, pre-compress at build time and serve the .br file directly to avoid runtime CPU cost:

brotli_static on;
gzip_static on;

6.4 What to Compress (and What Not to)

6.5 Verifying Compression

In Chrome DevTools Network tab, check the response headers for Content-Encoding: br or Content-Encoding: gzip. You can also compare the Size column (bytes transferred over the network) with the Content column (uncompressed size). A 100 KB HTML file served as 18 KB confirms effective Brotli compression.

From the command line:

curl -H "Accept-Encoding: br, gzip" -I https://example.com/ | grep content-encoding

7. Putting It Together: A Delivery Optimisation Checklist


8. Hands-On Exercise

Choose a real page (ideally one you have access to modify, or a public page you can analyse). Work through the following steps:

  1. Measure baseline TTFB. Use WebPageTest with a test location geographically distant from your server. Note the Waiting (TTFB) figure separately from the Initial Connection figure. Identify whether latency is server-side or network-side.
  2. Read the caching headers. Run curl -sI https://your-url.com/page/ and identify every cache-related header: Cache-Control, Age, ETag, X-Cache (CDN hit/miss indicator). Determine the effective cache strategy.
  3. Check protocol. Open DevTools Network, add the Protocol column, reload, and note the protocol for the HTML document, main CSS bundle, and main JS bundle. Are all on h2 or h3?
  4. Check compression. Click each major resource and confirm Content-Encoding: br. Calculate the compression ratio (Size ÷ Content).
  5. Write a diagnosis. Based on your findings, write a three-sentence diagnosis: what is the current delivery bottleneck, what is causing it, and what is the one change that would have the largest TTFB impact?

9. Milestone

You have mastered this module when you can:


Further Reading