Skip to content

Back the JWKS cache with the Workers edge cache - #1479

Merged
RhysSullivan merged 1 commit into
mainfrom
jwks-edge-cache
Jul 28, 2026
Merged

Back the JWKS cache with the Workers edge cache#1479
RhysSullivan merged 1 commit into
mainfrom
jwks-edge-cache

Conversation

@RhysSullivan

Copy link
Copy Markdown
Collaborator

Cold isolates paid a full round trip to the WorkOS JWKS endpoint inside workos.session.local_verify before serving their first request. An app-open burst fans out across many fresh isolates at once, so dozens of requests each stalled 1-2s in session verification simultaneously (traces: local_verify p50 is 0ms warm, 1.0-1.9s in every open-the-app burst).

Backs the in-memory JWKS cache with caches.default: a cold isolate reads the key set from the datacenter-shared cache instead of the upstream endpoint, and the first isolate to fetch populates it for the rest. Force-refresh (key rotation) bypasses the shared copy, since it is exactly as stale as the in-memory one, and overwrites it with the fresh set. The edge layer is best-effort: read failures are cache misses, write failures are dropped, and node (tests) degrades to upstream-only automatically.

Covered by new node tests: cold-isolate hit, miss-then-populate, malformed-entry fallthrough, rotation bypass-and-overwrite, and a failing cache backend.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud 8aa3e6c Jul 28 2026, 07:20 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing 8aa3e6c Commit Preview URL

Branch Preview URL
Jul 28 2026, 07:19 PM

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

@RhysSullivan
RhysSullivan marked this pull request as ready for review July 28, 2026 19:22
@RhysSullivan
RhysSullivan merged commit 75f16ed into main Jul 28, 2026
21 checks passed
RhysSullivan added a commit that referenced this pull request Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant