Repository navigation
docs: explain vm pool worker recycling cost - #10855
Merged
Merged
Conversation
✅ Deploy Preview for vitest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
sheremet-va
commented
Jul 30, 2026
Member
Author
|
Very relevant observation I found when working on vmThreads/vmForks difference on a large suite (~600 test files) |
3 of 5 tasks
macarie
previously approved these changes
Jul 31, 2026
Co-authored-by: Raul Macarie <raul@macarie.me>
macarie
approved these changes
Aug 4, 2026
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documents why worker recycling is expensive in the
vmThreadspool and cheap invmForks, and expandsvmMemoryLimitwith the trade-off between a low and a high limit.Background: profiling a large jsdom suite (zammad, 638 files) showed that when workers hit the default
vmMemoryLimit(total memory / maxWorkers),vmThreadspays a full garbage collection over the dying worker's heap inside the shared process. Thread stack samples showed 5-6 workers blocked inIsolate::Deinit->MarkCompactfor 15+ seconds each while the process-shared V8 background threads were saturated with marking work, starving live workers.vmForksrecycles by process exit, which the kernel reclaims in O(1); the same suite ran 130s onvmForksvs 235s onvmThreads. Raising the limit so recycling never happens made both pools slower, so recycling is necessary and the difference between the pools is the cost per recycle.Also corrects the documented
vmMemoryLimitdefault: it is1 / maxWorkers, not1 / CPU Cores.