-
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
Allow linux users to turn off delayed ACK for TCP #21104
Comments
I see this: In the above, do a ctrl-f for "quickack", see: perhaps setting QUICKACK is possible with Node.js HTTP, but not a Node.js TCP server? I didn't see any mention of QUICKACK in the Node.js net or http docs. |
@nodejs/libuv |
So here is what the Vertx docs say:
With these Node.js docs in mind: right now there seem to be only two options for a Node.js net server:
so this feature request is for at least one more option:
|
I tried creating a Node.js addon to change the setting: #include <nan.h>
#include <node.h>
#include <string>
#include <regex.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <unistd.h>
//using namespace v8;
using namespace std;
void run(const v8::FunctionCallbackInfo<v8::Value>& args) {
int socket_fd = (int)(args[0]->Int32Value());
int i = 1;
if(setsockopt(socket_fd, IPPROTO_TCP, TCP_QUICKACK, (void *)&i, sizeof(i)) < 0){
printf("setsockopt failed\n");
args.GetReturnValue().Set(false);
}
else{
args.GetReturnValue().Set(true);
}
}
void init(v8::Local<v8::Object> exports) {
NODE_SET_METHOD(exports, "run", run);
}
NODE_MODULE(run, init) but that didn't really do anything according to my testing |
Not sure about addons, but generally, this would have to be added to libuv first, similar to uv_tcp_nodelay which is exposed via It'd probably also make sense to have per-server settings for socket options, but right now, you have to set them on each connection's |
Beyond, TCP_QUICKACK, I believe there are a few other TCP flags/settings worth incorporating as well:
https://bradleyf.id.au/nix/shaving-your-rtt-wth-tfo/ Here is a thread on Golang for TFO: so maybe a more dynamic way to set any flag might be useful: socket.setOption(opts.X, value); |
I did a bit of research on Refs |
IMO abstracting |
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment. For more information on how the project manages feature requests, please consult the feature request management document. |
This is for all Node.js versions
re: https://jvns.ca/blog/2015/11/21/why-you-should-understand-a-little-about-tcp/
AFAIK, delayed ACK is the default on all Linux flavors. It would be interesting to have a way to turn off that flag, via a Node.js call.
I am not sure if there is a way to persistently set the flag, or if you need to set it for each TCP request. If the latter, perhaps it's prohibitively expensive. So perhaps it's only worth setting the flag on systems where the flag can be set persistently.
The text was updated successfully, but these errors were encountered: