Closed kelchy closed 8 years ago
yes, you can use a load balancer between the server and the outside world, like nginx (so you can reuse connections), but usually boils down to net configuration depending on your server. http://serverfault.com/questions/212093/how-to-reduce-number-of-sockets-in-time-wait
Can't we just close the TCP port when a reply is received?
TIME_WAIT happens after the connection is gone. we can't close the port manually, that's the OS layer that deals with this. the port is freed or reused after sometime, and since RPC is all about connection > request > payload > close, there's not much to do about it unless you tweak your server
my rpc server don't have the time_wait issue. only on the nodejs side. This is the weird part, that means my server sent the reply and closed the connection. but on the nodejs side, it is stuck in time_wait state.
all connections are closed after the request in http mode. socket, websocket and streaming keep the connection open for obvious reasons. time_wait happens when the local connection was closed but the other endpoint haven't
is there a way to prevent this from creating too many TIME_WAIT sockets?