Repository navigation
Description
Summary
Every integrated-benchmark scenario measures the pnpr accelerator with a hot resolution cache. The accelerator's pnpr-storage (its resolution + packument cache) is wiped once in WorkEnv::benchmark()'s upfront wipe, primed by the hyperfine warmup run, and never wiped per iteration — so every timed iteration hits a warm accelerator. The "cold" dimensions in the scenario names are all client-side (the client's packument cache and CAS store), plus the mock's tarball cache in the new …cold-store.cold-pnpr scenario.
So one cold dimension is untested: a cold pnpr resolution cache — the accelerator having to rebuild a resolve response from cold packuments (refetching them from origin) rather than answering from its warm cache.
| Cold dimension | Covered |
|---|---|
Client packument cache (cold-cache) |
✅ |
Client CAS store (cold-store) |
✅ |
pnpr tarball cache (cold-pnpr) |
✅ (pnpm/pnpm#12729) |
| pnpr resolution cache | ❌ |
Why it matters
The pnpr accelerator's win is resolution offload, and that path has an auth-aware resolution cache (pnpm/pnpm#12700). A cold-resolution scenario would measure (and guard against regressions in) the accelerator's cold-start resolution cost — the first request after a deploy/restart, or for a package the server hasn't resolved yet.
Proposed scenario
A fresh-install scenario (resolution must run — a frozen lockfile would skip it) that wipes the accelerator's pnpr-storage per iteration, so each timed run forces the accelerator to resolve from a cold packument cache:
- Add
pnpr-storageto the scenario's per-iterationcleanup.remove(today it's only in the one-time upfront wipe). - Keep the client cold too (
fresh-install.cold-cache.cold-store) or warm — TBD; the point is the server's resolution cache is cold each iteration. - Bencher consumes
pnpr@HEAD; the metric is the accelerator's cold-resolution latency.
Note: this is the resolution path, orthogonal to the tarball-streaming work in pnpm/pnpm#12729 — it guards pnpm/pnpm#12700's territory, so it belongs in its own change.
Context
Came out of the proxy-tarball streaming PR (pnpm/pnpm#12729), which added the cold tarball cache scenario; this is the matching cold resolution cache scenario.
Written by an agent (Claude Code, claude-opus-4-8).
Activity
officialaritro commentedon Sep 26, 2026
I would like to work on this.
I read the code and tested it with a local pnpr server. The proposed fix does not make the pnpr resolution cache cold. There are two problems:
entriesmap inpnpr/crates/pnpr/src/resolver.rs). The pnpr server runs for the whole benchmark. When I deletedpnpr-storagewhile the server ran, the next install took 1.7 s. A warm install took 1.7 s, and a cold install took 12.7 s.htpasswdinpnpr-storage, and pnpr putstokens.dbnext to it. So we must restart the server to clear the memory. But after a restart with an emptypnpr-storage, the client gets401 Unauthorized.Test setup: the benchmark fixture, pnpr and pnpm built from
main(a8994c61d8), the npm registry, a hot client store and an empty client cache.My plan:
htpasswdpath out ofpnpr-storage, for example to<bench_dir>/pnpr-auth/htpasswd.tokens.dbfollows it. I tested this layout: after a restart with an emptypnpr-storage, the old token still works and the install is cold again. I will also run one existing pnpr scenario before and after, to show that the numbers do not change.isolated-linker.fresh-install.cold-cache.hot-store.cold-pnpr-resolve. The client store stays hot, so the only variable cost is resolution on the pnpr server.--preparefor that scenario, stop the pnpr server, deletepnpr-storage, start the server again on the same port, and wait until it is ready. In my test, the restart took about 0.04 s.Questions:
--prepareacceptable? Or do you prefer a different way to clear the in-memory cache?test(pnpr): add a cold resolution-cache benchmark scenario
test(pnpr): add a cold resolution-cache benchmark scenario (pnpm#16246)