New Gen5 NVMe Cloud is now live in Frankfurt, Tokyo & São Paulo. Explore BeHost Cloud
Engineering

How we cut global TTFB by 61% with HTTP/3 and edge HTML caching

An 18-month project to rebuild our request path from the edge to the database — and the surprising bottlenecks we found along the way.

Glowing fiber optic cable ends in violet and teal light

In early 2025, our median time to first byte was respectable: 466 ms across all customer sites, measured from 24 cities. Respectable, but not remarkable — and remarkable is the bar our customers pay for. So we set ourselves an audacious goal: halve it within 18 months, for every plan, at no extra cost.

The problem

A request to a typical BeHost site used to travel through four hops: DNS resolution, a TLS handshake with our nearest edge, a cache lookup and — for anything dynamic — a full round trip to the origin server. For visitors far from the origin region, that last hop dominated everything.

  • 62% of HTML requests were cacheable but weren't being cached.
  • TLS 1.2 handshakes added 1–2 round trips on mobile networks.
  • Cache purges took up to 30 seconds to propagate globally.

Measuring what matters

Before changing anything, we rebuilt our observability. Synthetic tests from data centers lie: they sit on perfect networks. We deployed real-user monitoring across 50,000 consenting sites and started tracking p50, p75 and p95 TTFB per country, per device class.

“The single most useful chart we built showed TTFB by visitor distance from origin. It made the problem impossible to ignore.”

— Mateo Kovač, VP Infrastructure

Moving to HTTP/3

HTTP/3 runs over QUIC, which combines the transport and TLS handshakes and eliminates head-of-line blocking. On lossy mobile networks the improvement was dramatic. Enabling it was a single configuration line; making it reliable at our scale took nine months.

edge/listener.conf
listen 443 quic reuseport;
listen 443 ssl;
http3 on;
ssl_protocols TLSv1.3;
add_header Alt-Svc 'h3=":443"; ma=86400' always;
# 0-RTT only for idempotent requests
ssl_early_data on;
Good to know

HTTP/3 is now enabled by default on every BeHost plan. No configuration is required — browsers negotiate it automatically.

Caching HTML at the edge

Static assets were already cached at our 310 edge locations. HTML was the hard part: it changes, it's personalised and getting it wrong breaks shopping carts. We built a cache key that understands logged-in cookies, WooCommerce sessions and A/B test variants, then added instant purge-by-tag so updates propagate worldwide in under 150 ms.

Developer workstation with code on two monitors
Our edge cache key now accounts for 14 request attributes while keeping a 94% hit ratio.

The results

Eighteen months later, the numbers speak for themselves. Every customer got these improvements automatically.

MetricBeforeAfterChange
Median TTFB (global)466 ms182 ms−61%
p95 TTFB (mobile)1,840 ms610 ms−67%
HTML cache hit ratio38%94%+147%
Global purge time30 s150 ms−99.5%

What's next

We're now experimenting with running server-side rendering directly at the edge for frameworks like Next.js and Astro, and with predictive prefetching based on aggregate navigation patterns. Expect another deep dive in early 2027.

If problems like these excite you, we're hiring.

Rafael Osei
Rafael Osei Co-founder & CTO at BeHost

Rafael leads BeHost's engineering organisation. Before co-founding BeHost he built CDN infrastructure for a decade. He still reviews every edge-network pull request.

Talk to an engineer