← Back to context

Comment by silisili

2 days ago

At this point, this is an application level problem and not something the kernel should be silently doing for you IMO. An option for legacy systems or known problematic hosts fine, but off by default and probably not a per SOCKOPT.

Every modern language has buffers in their stdlib. Anyone writing character at a time to the wire lazily or unintentionally should fix their application.

The programs that need it are mostly the ones nobody is maintaining.

TCP_NODELAY can also make fingerprinting easier in various ways which is a reason to make it something you have to ask for.

  • > The programs that need it are mostly the ones nobody is maintaining

    Yes, as I mentioned, it should be kept around for this but off by default. Make it a sysctl param, done.

    > TCP_NODELAY can also make fingerprinting easier in various ways which is a reason to make it something you have to ask for

    Only because it's on by default for no real reason. I'm saying the default should be off.

    • >> TCP_NODELAY can also make fingerprinting easier in various ways which is a reason to make it something you have to ask for

      > Only because it's on by default for no real reason. I'm saying the default should be off.

      This is wrong.

      I'm assuming here that you mean that Nagle's algorithm is on by default, i.e TCP_NODELAY is off by default. It seems you think the only extra fingerprinting info TCP_NODELAY gives you is the single bit "TCP_NODELAY is on vs off". But it's more than that.

      In a world where every application's traffic goes through Nagle's algorithm, lots of applications will just be seen to transmit a packet every 300ms or whatever as their transmissions are buffered up by the kernel to be sent in large packets. In a world where Nagle's algorithm is off by default, those applications could have very different packet sizes and timings.

      With something like Telnet or SSH, you might even be able to detect who exactly is typing at the keyboard by analyzing their key press rhythm!

      To be clear, this is not an argument in favor of Nagle's algorithm being on by default. I'm relatively neutral on that matter.

      2 replies →

    • Nagles algorithm does really well when you're on shitty wifi.

      Applications also don't know the MTU (the size of packets) on the interface they're using. Hell, they probably don't even know which interface they're using! This is all abstracted away. So, if you're on a network with a 14xx MTU (such as a VPN), assuming an MTU of 1500 means you'll send one full packet and then a tiny little packet after that. For every one packet you think you're sending!

      Nagle's algorithm lets you just send data; no problem. Let the kernel batch up packets. If you control the protocol, just use a design that prevents Delayed ACK from causing the latency. IE, the "OK" from Redis.

  • If nobody is maintaining them, do we really need them? In which case, does it really matter?

    If we need them, and they’re not being maintained, then maybe that’s the kind of “scream test” wake up we need for them to either be properly deprecated, or updated.

    • > If nobody is maintaining them, do we really need them?

      Given how often issues can be traced back to open source projects barely scraping along? Yes and they are probably doing something important. Hell, if you create enough pointless busywork you can probably get a few more "helpfull" hackers into projects like xz.

So to be clear, you believe every program that outputs a bulk stream to stdout should be written to check if stdout is a socket and enable Nagle's algorithm if so? That's not just busywork - it's also an abstraction violation. By explicitly turning off Nagle's, you specify that you understand TCP performance and don't need the abstraction, and this is a reasonable way to do things. Imagine if the kernel pinned threads to cores by default and you had to ask to unpin them...

  • > That's not just busywork - it's also an abstraction violation.

    You used AI to write this didn't you? Your sentence structure is not just tedious - it's a dead give-away.

  • No, the program should take care to enable TCP_NODELAY when creating the socket. If the program gets passed a FD from outside it's on the outside program to ensure this. If somehow the program very often gets outside FDs from an oblivious source that could be a TCP socket, then it might indeed have to manually check if it really wants Nagle's algorithm.