Enable TCP_NODELAY for SSH client/server 08/96308/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 17 May 2021 15:10:45 +0000 (17:10 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 21 May 2021 09:10:29 +0000 (09:10 +0000)
Both NETCONF northbound (SshProxyServer) and southbound
(AsyncSshHandler) plugins exhibit latencies caused by Nagle's algorithm.
These are superfluous, as we typically work in request-response manner,
with reasonable level of buffering going on in the intermediate layers.

Set TCP_NODELAY flag to get rid of these artifacts.

JIRA: NETCONF-776
Change-Id: I68a87cc2bef4f0032e104833b8d241f5b1f7566b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 726ee92c6052437074062ffe790743eab58de2af)

netconf/mdsal-netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/SshProxyServer.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java

index 1630c1b6d647361faae1063fc86afd8d6af3286a..cdc730fc17370d6c57a034d31aefadebd3bb20cf 100644 (file)
@@ -103,6 +103,7 @@ public class SshProxyServer implements AutoCloseable {
         }
         sshServer.getProperties().put(CoreModuleProperties.NIO2_READ_TIMEOUT.getName(), nioReadTimeout);
         sshServer.getProperties().put(CoreModuleProperties.AUTH_TIMEOUT.getName(), String.valueOf(idleTimeout));
+        sshServer.getProperties().put(CoreModuleProperties.TCP_NODELAY.getName(), true);
 
         final RemoteNetconfCommand.NetconfCommandFactory netconfCommandFactory =
                 new RemoteNetconfCommand.NetconfCommandFactory(clientGroup,
index 0eb635ef3d0866599909888ecdbe175eb2269162..f33fdd8328257ba5e099c3e4e28022dad2e97105 100644 (file)
@@ -47,6 +47,7 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
         c.getProperties().put(CoreModuleProperties.AUTH_TIMEOUT.getName(), "0");
         c.getProperties().put(CoreModuleProperties.IDLE_TIMEOUT.getName(), "0");
         c.getProperties().put(CoreModuleProperties.NIO2_READ_TIMEOUT.getName(), "0");
+        c.getProperties().put(CoreModuleProperties.TCP_NODELAY.getName(), true);
 
         // TODO make configurable, or somehow reuse netty threadpool
         c.setNioWorkers(SSH_DEFAULT_NIO_WORKERS);