-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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
scale the socket receive buffer on the fly #39092 #39097
base: main
Are you sure you want to change the base?
Conversation
Sorry, I meant to refer to #39092 |
Can't the |
Not if you are piping |
I don't follow. If you had |
The way I understand this part of the code, is that this buffer is static and it is reused for every write? Which is a very good idea performance-wise, but I don't think you can make it work with the current piping implementation? |
Not necessarily, the |
Yes, I agree, I had missed the part in |
I would lean more towards the former unless there is strong evidence with data to back it up that this scaling behavior should existing in node core by default. |
Co-authored-by: Darshan Sen <[email protected]>
This is subject of discussion of course.
|
The |
It uses less memory for slow connections - and when it comes to fast connections don't forget that the kernel too allocates up to 256Kb per successful TCP connection (ie after the SYN exchange) - so normally, if it worked before, it should continue to work I will be on solar power for some time, so I can't build Node from here to test it I made a draft PR because there a few points that need discussing:
|
Seeing as how we're dealing with streams here, nobody should be relying on chunk sizes. |
What's the status here? If we still want to land this, it should be rebased on top of |
As an experiment, I tried scaling the receive buffer on the fly depending on how full it was on the last iteration
It has the advantage of using less memory for slow streams and being more efficient for faster streams
It does not allow for manual control (but this can probably be added) and it effectively short-circuits the back pressure mechanism - as the first read always gets through - which is not very well suited for stream originating from the network