Skip to content

JCU: expose SSR cache hits, misses and hit rate - #1681

Merged
vidiecan merged 2 commits into
customer/jcufrom
jcu/fe-ssr-cache-hit-miss
Oct 29, 2026
Merged

vidiecan merged 2 commits into
customer/jcufrom
jcu/fe-ssr-cache-hit-miss

Conversation

@vidiecan

@vidiecan vidiecan commented Oct 29, 2026 •

Copy link
Copy Markdown

The SSR stats endpoint now exposes per-worker, per-cache hits, misses, and hitRate.

Only three files change:

  • server.ts: keep two counters per cache, increment them in the existing hit/miss branches, and pass them to the stats snapshot. No extra request-path lookups, branches, or allocations.
  • src/backend/ssr-cache-stats.ts: type and expose the counters; calculate hitRate only when stats are polled. Stale pages served count as hits; the rate is null before any lookups. Counters reset on worker restart.
  • scripts/test-ssr-cache-stats.js: adjust the existing snapshot tests for the added fields and rate. No new test cases.

Validation: npm run test:ssr-cache-stats passed (7 tests), focused TypeScript check passed, and git diff --check passed.

@vidiecan
vidiecan marked this pull request as ready for review October 29, 2026 17:08
@vidiecan
vidiecan merged commit b9b6741 into customer/jcu Oct 29, 2026
5 checks passed
@vidiecan
vidiecan deleted the jcu/fe-ssr-cache-hit-miss branch October 29, 2026 17:08
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