-
Notifications
You must be signed in to change notification settings - Fork 30.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backpressure on http.ServerResponse #10256
Comments
you don't have enough data for pressure. The get request has an empty message body! Also, the client may not be reading yet, but the client TCP stack is. It will read enough data to fill its buffer, at which point data will stop flowing until the client app (node) reads data from the TCP stack. In this case, you have no data to speak of, so it all goes across TCP and is buffered in the client stack. Do a giant, giant POST and you may see what you were hopeing for. |
I'm only testing back-pressure in the response here, not in the request. |
Hmm, it seems like a gigabyte (10003) is the magic number. Above that, I don't get |
I think it's also the way the pipe's working. If I write the Gb in one go, I get I guess this is because writing in two chunks gives the pipe a chance (after the first write) to notice that |
... which means the TCP buffers are lower than Gb and I need to do some more testing for the figure on my system. @sam-github thanks for the pointer. |
Localhost TCP buffers might be incredibly high, because on localhost the data buffering cost is all on your host, doesn't matter if its the sender's or the receiver's buffers. I'm not saying it is... but localhost TCP does bypass some TCP protocol lower layers as irrelevant when not running over a network. You could try over a network. Also, I've never seen the passthrough stream, it could be you are just observing and oddity of it. |
If I write 16MB in 2 chunks then I get the backpressure. 16MB seems reasonable. |
Here's a test program:
I expected it to display:
because the client-side isn't reading from the response so back-pressure should be applied via
res
topthru
.However, it actually displays:
I think maybe I'm missing something, or is this a bug?
The text was updated successfully, but these errors were encountered: