http.createServer highwatermark configΒ #32731
Copy link
Copy link
Closed
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.httpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.streamIssues and PRs related to Node.js streams.Issues and PRs related to Node.js streams.
Description
Is your feature request related to a problem? Please describe.
http.get allows you to set highwatermark values as of node 13.x. Both IncomingMessage and OutgoingMessage supports setting hwm values in config, those settings are also applied to socket. why can't we do the same for http.createServer
#30135
Describe the solution you'd like
set highwatermark and enable objectMode for response (writable).
Describe alternatives you've considered
Please describe alternative solutions or features you have considered.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.httpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.streamIssues and PRs related to Node.js streams.Issues and PRs related to Node.js streams.
Activity
bnoordhuis commentedon Apr 9, 2020
What would that do? It's not at all clear to me what use that has. Please elaborate.
0807Jpatel commentedon Apr 9, 2020
We are trying to generate backpressure over the network. we would like our highwatermark to be 5kb, but this is negated since response's highwatermark is always set to 16kb. we would like to be able to decrease it. so that it can generate back pressure faster.
bnoordhuis commentedon Apr 10, 2020
Do I understand correctly you want to be able to override
writableHighWaterMarklike this?0807Jpatel commentedon Apr 10, 2020
Yes that's exactly what we would like to do. But I don't think it's possible to overwrite
writablehighwatermarkafter stream is created. So the simplest solution would be to implement athttp.createServerlevel just likehttp.getbnoordhuis commentedon Apr 10, 2020
It's read-only right now but that could probably be changed if there's a good enough use case. I've updated the labels.
Having requests inherit it from the
http.Serveris both clunky and inflexible, IMO.0807Jpatel commentedon Apr 11, 2020
@bnoordhuis how do we go about this? As far as I can tell both objectMode and highwatermark values for our stream are useless as long as we can't edit those values for response stream.
bnoordhuis commentedon Apr 12, 2020
You can open a pull request with your suggested change. If you're not completely sure yet what direction to take, it's okay to open it in an incomplete state as a draft, to collect feedback.
You mentioned response in your original comment. Which one is it?
0807Jpatel commentedon Apr 13, 2020
response. yea that was a typo, and I will try to get a pull request, soon.
ronag commentedon May 15, 2020
There are other way to create back pressure. You can pipe it through a transform stream that applies it.