Skip to content

Feature Request: Option to configure highWaterMark of HTTP response #30107

Closed
@trentmwillis

Description

@trentmwillis

Is your feature request related to a problem? Please describe.

We have a Node service that loads a bunch of data over an HTTP connection using Server-Sent Events. We noticed, when comparing to implementations in other languages, that the data we receive winds up being in many more "chunks" in Node which leads to some performance issues.

After some digging, it seems that the issue is that http.ServerResponse received when using http.request() uses the default highWaterMark value of 16kb inherited from the default ReadableStream class. This is much smaller than some of the messages we're processing which we believe is the cause of the perf issues since we must reconstruct the messages before parsing them fully.

Describe the solution you'd like

Ideally, an option to configure the highWaterMark size of a response when calling http.request.

It might be that there is a way to do what we need here, but I was not able to find it if so. So I'm open to feedback on that front.

Describe alternatives you've considered

Some way to override the default highWaterMark size of a stream (e.g., a CLI option), but that feels more expansive than needed.

Thanks in advance for your help/consideration 😃

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.httpIssues or PRs related to the http subsystem.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions