-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
Increase buffer pool size and streams high water marks #27121
Copy link
Copy link
Open
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.performanceIssues and PRs related to the performance of Node.js.Issues and PRs related to the performance of Node.js.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Metadata
Metadata
Assignees
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.performanceIssues and PRs related to the performance of Node.js.Issues and PRs related to the performance of Node.js.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Our Buffer pool size is currently set to 8kb. This seems pretty low for most hardware used these days.
Similar with our default high water marks in streams (16kb for all streams besides fs readable streams that are set to 64kb).
Increasing the buffer size allows less allocations to be used in general and increasing the default high water mark reduces the number of chunks which improves the throughout a lot.
I would like to increase the buffer pool size to 128kb. The regular high water mark could increase to 64kb and the high water mark for fs to e.g., 256kb.
Those numbers are all "magical" numbers but they seem better defaults than the current ones. Please let me know if there are reasons to either not change the defaults or if you have an alternative suggestion.
It is also possible to change the Buffer's pool size default during runtime and to set each high water mark per stream.
@nodejs/fs @nodejs/streams @nodejs/buffer PTAL