Menu

Cutting Global TTFB by 65% on Cloudflare Workers & D1: Edge HTML Caching + Read Replicas in Production
📰

Cutting Global TTFB by 65% on Cloudflare Workers & D1: Edge HTML Caching + Read Replicas in Production

DEV Community: nextjs·mao liang·1 day ago
#o6JItSBL
#devtonextjs#devto#dev#cache#headers
Long article (1126 words) — no AI summary yet.
Reading 0:00
15s threshold

When we launched ChineseKit — a free Chinese-English dictionary with animated stroke order, radical breakdowns, and HSK 1–9 vocabulary lists — we placed our primary Cloudflare D1 database in Eastern North America ( ENAM ) to stay close to Googlebot and North American learners.

That worked fine locally, until we looked at two real-world numbers:

Google Search Console crawl latency hovered between 920ms and 1,340ms per HTML response, stalling indexing across more than 10,000 common character pages.

Cold requests from Asia ( TPE edge PoP) took 4.93s TTFB on a single character page because every SSR render had to cross the Pacific for multiple D1 queries.

Here are the two concrete changes we shipped to drop cold TTFB by 65% ( 4.93s → 1.70s ) and warm HTML responses down to 0.70s ( ~0.24s excluding TLS) — plus two subtle Cloudflare platform traps that caught us along the way.

Fix 1: GDPR-Safe Edge HTML Caching via Workers Cache API

Dictionary pages like 学 (xué) or HSK 1 vocabulary rarely change, yet every…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.