set tcp_nodelay
Submit the tcpnodelay Configuration Switch
Performance Optimization:
The server sends the SSH2_MSG_CHANNEL_OPEN_CONFIRMATION message immediately after sending the public key information (SSH2_MSG_GLOBAL_REQUEST).However, the client does not need to send any message (the SSH2_MSG_CHANNEL_Open and SSH2_MSG_GLOBAL_REQUEST messages have been sent). Therefore, after the client receives the message, the kernel waits for 40 ms to send an ACK message(due to the Nagle's algorithm). As a result, the server kernel needs to wait until the ACK with a delay of 40 ms is received when sending SSH2_MSG_CHANNEL_OPEN_CONFIRMATION.
In fact, the client and server set the socket status to TCP_NODELAY after the channel is established (received).
We will set TCP_NODELAY in advance until after authentication is complete. We can also add a configuration option. When users are sensitive to performance, TCP_NODELAY is set after the TCP connection between the server and client is established.
This modification results in a 20% performance improvement in frequent short-connection environments. An SSH connection takes about 200 ms. Setting TCP_NODELAY can optimize the performance of 40 ms.
https://bugzilla.mindrot.org/show_bug.cgi?id=3768
@djmdjm Can you review the pull request?
@djmdjm @daztucker hello, can you review the pull request?
We already unconditionally set nodelay fairly early on the connection socket (e.g. here). Is there some path where this isn't happening?
The issue has been fixed. OpenBSD-Commit-ID: 325fc41717eecdf5e4b534bfa8d66817425b840f