node-http-proxy icon indicating copy to clipboard operation
node-http-proxy copied to clipboard

Lot of TCP retransmits generated when proxying WebSockets. due to KeepAlive settings?

Open kristofen opened this issue 9 years ago • 3 comments

Hi,

Last couple of days I've been trying to implement (with node-http-proxy) a proxy for a simple chat app with http and websocket.

I noticed a lot of TCP retransmits packets generated by the proxy server.

capture

I've searched in the code and it seems that there is a problem with the setKeepAlive call in lib/http-proxy/common.js

common.setupSocket = function(socket) {
  socket.setTimeout(0);
  socket.setNoDelay(true);

// line below actually ENABLEs KeepAlive with a 0 MS delay !!!
  socket.setKeepAlive(true, 0); // <--- 

  return socket;
};

The current line is enabling keepalive with zero millisecond delay which can be disastrous regarding performance.

I've commented setKeepAlive line and I have no more TCP reteransmits..

Is there a reason for setting TCP keepalive to 0 ms delay ?

It may be better to leave this setting to default value (ie: setKeepAlive(false,0) ) ?

Best

kristofen avatar Sep 15 '15 15:09 kristofen

Hi,

I have the same problem on Windows 7 Ultimate Service Pack 1

under Linux and Windows 10 no problem !!!

Best

pascalStm avatar Nov 16 '15 16:11 pascalStm

Hey, is this problem solved? My website is running on windows server 2016 and I am experiencing the same problem.

pxgo avatar Jan 19 '19 06:01 pxgo

+1

SSANSH avatar Aug 26 '22 12:08 SSANSH