Skip to content
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

net: activate setNoDelay by default #40778

Closed
wants to merge 3 commits into from
Closed

net: activate setNoDelay by default #40778

wants to merge 3 commits into from

Conversation

voxpelli
Copy link

@voxpelli voxpelli commented Nov 10, 2021

Fixes #34185

This is kind of a draft and is eg. lacking tests as I don't know how to test this (partly because it interacts deeply with the OS) and the fact that the current setup isn't tested either, so its an extra uphill in creating tests for this tiny change of default.

So, remaining:

  • Implement change
  • Test change
  • Document change

I'm opening a PR anyway, so I don't block #34185 and maybe can get some help on how to proceed.

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem. labels Nov 10, 2021
@mcollina
Copy link
Member

This is kind of a draft and is eg. lacking tests as I don't know how to test this (partly because it interacts deeply with the OS) and the fact that the current setup isn't tested either, so its an extra uphill in creating tests for this tiny change of
default.

There is a failed test already that's related to this change. I think we can just update the test and we are good.

@mcollina mcollina added notable-change PRs with changes that should be highlighted in changelogs. semver-minor PRs that contain new features and should be released in the next minor version. baking-for-lts PRs that need to wait before landing in a LTS release. labels Nov 11, 2021
@mcollina
Copy link
Member

I flagged this as minor but baking-for-lts. We might decide if we want to backport it or not later.

cc @nodejs/tsc

@nodejs-github-bot
Copy link
Collaborator

@nodejs nodejs deleted a comment Nov 12, 2021
@nodejs nodejs deleted a comment Nov 12, 2021
@voxpelli
Copy link
Author

There is a failed test already that's related to this change. I think we can just update the test and we are good.

I have now adapted the tests to take into account that the new default is true and thus in a way inverted the expectations on call counts and such.

@addaleax
Copy link
Member

This definitely needs documentation, both in the docs themselves and in the changes: entries list(s).

I would definitely recommend not backporting this to LTS versions.

@voxpelli
Copy link
Author

@addaleax 👍 Any pointers on where/how I can document this? Sorry, first PR to Node core for me

@lpinca
Copy link
Member

lpinca commented Nov 13, 2021

Is there a reason for changing a default instead of disabling the Nagle's algorithm before a request is made? Wouldn't it be better to call socket.setNoDelay() before emitting the 'socket' event?

req.emit('socket', socket);

By doing this, the change would only affect the HTTP/S case and not all created sockets that could be used for something else.

@voxpelli
Copy link
Author

Is there a reason for changing a default instead of disabling the Nagle's algorithm before a request is made? Wouldn't it be better to call socket.setNoDelay() before emitting the 'socket' event?

To make it still be configurable?

Also: Is there any case where we want to have this enabled by default?

@lpinca
Copy link
Member

lpinca commented Nov 16, 2021

I think it's enabled by default on Linux? My point is, if we want to disable it for HTTP, then why changing it for all TCP sockets?

@voxpelli
Copy link
Author

I think it's enabled by default on Linux? My point is, if we want to disable it for HTTP, then why changing it for all TCP sockets?

Right, true, I can look into making a PR that only does it for the http-client, would relate to #31539

@voxpelli
Copy link
Author

As #34185 is fixed by #42163 this PR no longer serves a purpose, closing it.

@voxpelli voxpelli closed this Mar 22, 2022
@voxpelli voxpelli deleted the tcp-no-delay-by-default branch April 8, 2022 12:03
@targos targos removed the baking-for-lts PRs that need to wait before landing in a LTS release. label Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem. notable-change PRs with changes that should be highlighted in changelogs. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Follow curl: Enable setNoDelay() / TCP_NODELAY by default on HTTP(S) 1.x
6 participants