Skip to content

perf: reduce database egress and prewarm published pages - #189

Merged
f0rr0 merged 3 commits into
nextfrom
f0rr0/worker-egress-cache
Oct 1, 2026
Merged

f0rr0 merged 3 commits into
nextfrom
f0rr0/worker-egress-cache

Conversation

@f0rr0

@f0rr0 f0rr0 commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Dirty GitHub projections repeatedly downloaded complete historical file statistics: the busiest observed repository returned 2.15 MB per projection, including 1.99 MB of unchanged file data. Read live metadata in the existing repeatable-read transaction and reuse digest-keyed evidence in small SHA groups; fetch only missing groups. Cache raw summary evidence separately, including patch-pruning state in commit keys. Ownership, visibility, coverage, authors and counters remain live inputs.

Share public GitHub and Codex snapshots between cron and page bundles using explicit Vercel Runtime Cache keys scoped to the project and database. Cold timeouts reuse their original read, successful outage snapshots remain available, and publication invalidation is retained. Cache reads are bounded. Optional cache writes finish outside the snapshot-read deadline, so delayed persistence cannot replace fresh results with older outage data. Codex history and view writes overlap. Compression keeps entries within provider limits, with ordinary DB reads for oversized entries. Remove obsolete Next cache wrappers, tag invalidation and unused native-cache test setup.

Publication invalidation also left the next visitor to rebuild Home and Work. Production requests took 4.18 s and 4.60 s before HTML, with Vercel logs identifying delete_tag regeneration. Extend the existing post-publication task to warm the rendered pages after warming their data. Only production performs these concurrent GETs within the remaining invocation budget, reserving one second before its execution limit; preview, idle cron and failed snapshot reads skip them. Warming failures preserve normal regeneration and cannot fail the publication response. Visitors during regeneration or warming failure can still incur a cold render.

Validation:

  • 309 logic/rendering tests pass; two existing opt-in database tests remain skipped. No new database tests.
  • Regression checks preserve private repository masking and fresh Codex stats under slow cache persistence, true-read outage fallback, and remaining-time abort/expired-budget behavior.
  • Strict production build, typecheck, formatting, lint and both unused-code checks pass.
  • Separately compiled production API and SSR bundles share one body read through the native SDK and a mock HTTP cache provider.
  • Desktop and mobile browser checks pass for pagination, retained expansion, refresh failures/retry, new-day insertion, ordering-only refresh, stale pagination cancellation, overflow and runtime errors.
  • Empty-browser-cache production samples with cached server HTML: Home FCP 208–604 ms, Work FCP 200–708 ms, Home → Work 113–160 ms, no layout shifts. Production remains PR188; these are baseline measurements.
  • Actual page-warming helper in a production Next build with mocked data/cache and an injected 600 ms render: first visitor 822 ms/MISS without page warming versus 8 ms/HIT after warming. Both return the latest publication, with exactly one regeneration and one body read shared across background and page bundles. Production latency gains require deployment verification.
  • Read-only production aggregates estimate 2.15 MB → 0.16 MB for the busiest repository's unchanged projection query (92% reduction), and 75–90% reduction when one SHA group changes. These are response-size estimates for that query, not measured daily billing reductions. The below-100-MB/day target needs post-deployment measurement.

No UI, loading-state, PostHog or database schema changes.

@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
f0rr0-github-io Ready Ready Preview Oct 1, 2026 10:44pm UTC

@f0rr0 f0rr0 changed the title perf: reduce worker egress with immutable evidence caching perf: reduce database egress and prewarm published pages Oct 1, 2026
@f0rr0
f0rr0 marked this pull request as ready for review October 1, 2026 22:51
@f0rr0
f0rr0 merged commit 514b546 into next Oct 1, 2026
4 checks passed
@f0rr0
f0rr0 deleted the f0rr0/worker-egress-cache branch October 1, 2026 22:51

This branch was successfully deployed

1 active deployment
Preview — ca3048e8 Deployed Oct 1, 2026 by vercel[bot]
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