@milaboratories/pl-deployments 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/ssh/ssh.ts CHANGED
@@ -196,6 +196,14 @@ export class SshClient {
196
196
  return;
197
197
  }
198
198
 
199
+ // Remove TCP buffering.
200
+ // Although it means less throughput (bad), it also less latency (good).
201
+ // It could help when we have
202
+ // small messages like in our grpc transactions.
203
+ // And it also could help when we have tcp forwarding to not buffer messages in the middle.
204
+ (conn as any).setNoDelay(true);
205
+ localSocket.setNoDelay(true);
206
+
199
207
  let stream: ClientChannel;
200
208
  try {
201
209
  stream = await forwardOut(this.logger, conn, '127.0.0.1', 0, '127.0.0.1', ports.remotePort);
@@ -666,6 +674,13 @@ async function connect(
666
674
  });
667
675
 
668
676
  client.connect(config);
677
+
678
+ // Remove TCP buffering.
679
+ // Although it means less throughput (bad), it also means less latency (good).
680
+ // It could help when we have
681
+ // small messages like in our grpc transactions.
682
+ // And it also could help when we have tcp forwarding to not buffer messages in the middle.
683
+ (client as any).setNoDelay(true);
669
684
  });
670
685
  }
671
686