You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
This is perfectly acceptable for normal streams that deal in bytes, since buffering 16 kB is fine.
However, for objectMode streams, this is not a sane default. The highWaterMark applies to the count of buffered objects, not their total size. A single object can occupy many thousands of bytes on the heap. If dealing with larger objects (say, 16 kB each because they contain long strings), a single stream can buffer 256 MB in memory, which is not fine. With large enough data and/or number of streams, this can easily lead to an unexpected crash.
We should set a smaller default highWaterMark on streams created in objectMode. I'm not exactly sure what the right number is or what kind of impact that change would have on existing programs, but if there's agreement with the idea, I'm happy to whip up a patch.
The text was updated successfully, but these errors were encountered:
The default
highWaterMark
for streams is 16,384.This is perfectly acceptable for normal streams that deal in bytes, since buffering 16 kB is fine.
However, for
objectMode
streams, this is not a sane default. ThehighWaterMark
applies to the count of buffered objects, not their total size. A single object can occupy many thousands of bytes on the heap. If dealing with larger objects (say, 16 kB each because they contain long strings), a single stream can buffer 256 MB in memory, which is not fine. With large enough data and/or number of streams, this can easily lead to an unexpected crash.We should set a smaller default
highWaterMark
on streams created inobjectMode
. I'm not exactly sure what the right number is or what kind of impact that change would have on existing programs, but if there's agreement with the idea, I'm happy to whip up a patch.The text was updated successfully, but these errors were encountered: