Repository navigation
Description
Problem
On a cold frozen install of the pinned Next.js workspace from pnpm/pnpm#13305, the TypeScript CLI completed in 11.30s while the Rust CLI completed in 13.84s on the same machine and dependency graph.
Investigation indicates that many tarballs are downloaded concurrently while each tarball with at least 32 files also uses inner parallel extraction. This nested parallelism increases scheduling and filesystem contention. As an experiment, effectively disabling per-tarball parallel extraction improved Rust fetch performance, but applying that globally could regress workloads with one or a few very large tarballs.
The concurrent integrity/extraction benchmark added by pnpm/pnpm#13433 provides a deterministic regression workload for the many-tarball case.
Proposed investigation
Test an adaptive, globally bounded extraction strategy rather than simply increasing or removing PARALLEL_EXTRACT_THRESHOLD:
- preserve inner parallel extraction when only a few large tarballs are active;
- prefer sequential extraction within each tarball when many tarballs are already in flight;
- prevent outer package concurrency from multiplying unboundedly with per-tarball file concurrency.
Before choosing an implementation, parameterize the integrity benchmark across:
- 1, 8, 32, 128, and 256 concurrent tarballs;
- 8, 32, 64, 256, and 2,048 files per tarball;
- small and large files;
- compressible and incompressible content.
End-to-end validation
Validate baseline Rust against candidate Rust on:
- The pinned Next.js cold frozen-install reproduction.
- All 48 installation scenarios from fix: restore pnpm v12 benchmarks vltpkg/benchmarks#132:
- fixtures: Next.js, Astro, Svelte, Vue, Large, and Babylon.js;
- states: clean, cache, cache plus lockfile, cache plus
node_modules, cache plus lockfile plusnode_modules, lockfile, lockfile plusnode_modules, andnode_modules.
- The vlt
build,build-cache, andrunscenarios as correctness checks. - Single-large-tarball microbenchmarks that exercise the workload most likely to benefit from inner parallel extraction.
Run at least five measured iterations after warmup. Repeat apparent regressions with baseline/candidate order reversed so machine drift is not mistaken for an implementation effect.
Acceptance criteria
- The Next.js cold frozen install improves by at least 10%.
- The concurrent-tarball microbenchmark improves materially.
- No repeatable vlt installation scenario regresses by more than 3%.
- Single-large-tarball scenarios do not regress by more than 3%.
- Aggregate vlt performance does not regress.
- Package counts, exit codes, lockfiles, and installed dependency graphs remain equivalent.
The optimization should not be merged if it only exchanges the Next.js regression for a regression in low-concurrency or large-tarball workloads.
Written by an agent (Codex, GPT-5).
Activity
github-actions commentedon Jul 27, 2026
Oz triage is running now and will classify this issue and apply one pnpm
state:label.Follow along in Oz: https://app.warp.dev/run/019fa406-ffb9-7204-b79f-9fb13fb7780a
github-actions commentedon Jul 27, 2026
Triage result
Ready to specstate: needs designpnpm/crates/tarball). No TypeScript parity needed — the TypeScript CLI is the faster baseline here, not the target of changes.PARALLEL_EXTRACT_THRESHOLD, globally-bounded fan-out semaphore, adaptive per-tarball vs. pool routing), and the correct choice depends on empirical data from the 5×5 tarball/file-count matrix. The concurrent benchmark infrastructure landed in PR test(benchmark): cover concurrent integrity extraction pnpm#13433 (merged), so the prerequisite tooling is in place. The acceptance criteria are clear, but the design is not.pnpm/crates/tarball/src/lib.rs— specifically thePARALLEL_EXTRACT_THRESHOLDconstant (line 898),cas_write_pool()(line 82), andpost_download_semaphore()(line 59). The problem is thatpost_download_semaphoreallowsnum_cpus * 2concurrent tarballs in flight, and each tarball with ≥32 files fans out across the dedicatedcas_write_pool(also sized tonum_cpus), creating up tonum_cpus² * 2concurrent CAS writes.Written by an agent (Oz, auto).
hood commentedon Nov 9, 2026
Some macOS data for this one. The nested fan-out shows up there too, mostly as system time rather than wall time.
Setup: pnpm 12.18.0 built from pnpm/pnpm@3600b05d00, M1 Pro (10 cores), APFS. Fixture is the integrated-benchmark one (1356 snapshots, ~33k files). Cold store,
install --frozen-lockfile --ignore-scriptsagainst registry.npmjs.org. The machine runs an EDR (Carbon Black plus a JumpCloud ES extension), so absolute syscall costs are inflated. That's pretty common on corporate dev Macs tbh.Cold install
pnpm fetch(store only) alone is 24.6 s sys, so almost all of it is the store write, not linking.The global rayon pool isn't the cause
RAYON_NUM_THREADSSys stays at ~27 s whatever the rayon size. The wall numbers are network-noisy, so I wouldn't read much into them.
Who's in the kernel
Thread census mid-install: 40
tokio-rt-worker(10 async plus ~30 blocking frompost_download_semaphoreandstreaming_extract_semaphore), 10cas-write, 16 global rayon, 4pnpm-link.sampleover 7 s of a cold install, thread-ms on the leaf syscall (symbolized build):cas-writeopenStoreDir::write_cas_fileBufferedExtraction::run)openStoreDir::write_cas_filecas-write+ blockingwriteStoreDir::write_cas_filecas-write+ blockingcloseStoreDir::write_cas_filepnpm-linkclonefileatlink_file::clone_tier,dir_clone_cachecas-write+ blockingstat(parent dir)unix_creation_modecas-write+ blockingfstatgrant_mode_bitsA create-
opencosts ~250 µs here vs ~100 µs for a per-fileclonefileat. So ~40 threads are queueing on the metadata path thatdir_clone_cache.rsalready describes as serialized volume-wide, and the queueing is what burns the sys time.Takeaways for the design
PARALLEL_EXTRACT_THRESHOLDplus thecas-writepool, not the rayon pool.statinunix_creation_modeis ~3% of CAS syscall time. The shard dirs' mode could be cached once per dir.Repro
(Looks sloppy as I’m on the move and did a speech-to-text -> polish with an agent - Claude Code, claude-opus-5-5).