Repository navigation
Replies: 1 comment
|
Design PR #4790 proposes |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
On Workers with D1, a cached page is fast (16 to 40 ms) and an uncached one is slow. Two things add up on a miss:
migrations: { runtime: "manual" }, Smart Placement with a KV object cache, and the existingdurableObjects()adapter each help a little, but none removes both the per-query round trip and the cold isolate.Use case
Small and medium sites on the Cloudflare templates: blogs, club sites, marketing sites. Most visitors hit the cache, but crawlers, editors, new regions and every page after a publish or deploy take the slow path. On scllauerz.ch, CoreDash counted 26% of real page loads at 875 ms TTFB or more over 31 days on D1, although zone analytics showed only 0.8% misses.
Current workarounds
I run three sites (scllauerz.ch, kevinkyburz.ch, linguadash.dev) on a prototype that needs no change to
emdashor@emdash-cms/cloudflare1.4.0. A tiny front Worker owns the Workers Cache and forwards misses over RPC to one Durable Object per site. The object runs the normal Astro SSR app with an in-process Kysely dialect onctx.storage.sql, wired throughdatabase: { entrypoint, type: "sqlite" }and a customcache.provider.Uncached HTML median from zone analytics, 7 days on D1 against the days since the switch on November 8:
Known limits today: all misses go to one region, one object handles one request at a time (about 120 uncached renders per second on the demo, about 20 on kevinkyburz.ch, no errors up to 160 concurrent), sandboxed plugins don't work because the bridge reads
env.DB(#1623, #4406, #4725), and there is no D1 Time Travel orwrangler d1 export. Full measurements: https://kevinkyburz.ch/blog/emdash-durable-object/Your involvement
I'd implement it in small PRs: shared DO SQLite execution code, the in-process dialect with workerd tests, the site object and front Worker in
@emdash-cms/cloudflaremarked experimental, then export/import and docs. The RFC lists 18 open questions, including whether this belongs in core at all. I'll open it as an RFC design PR and link it here.~ 🤖 drafted with Claude Opus 5.5, reviewed by @swissky
All reactions