On Fri, Feb 22, 2008 at 6:42 AM, Kevin Conaway <[EMAIL PROTECTED]> wrote: [...] > Which is better: > Having sockets on the client side in FIN_WAIT_2 and CLOSE_WAIT > or > Having sockets on the server side in TIME_WAIT
Well, if you ask generically then the answer is: it depends. I.e., if you're talking about the typical usage where the server is the contended resource then it's better for each client to pay the extra costs where possible. For example, it's more efficient if the client initiates the close() at the network level -- the server's close() will then find the socket, on the server, (potentially much) faster to reap and therefore become usable for a new client connection sooner. This is even worse when the connection has high latency (slow / far away) and/or is noisy (i.e., dropping packets) and so things like the TCP windows end up being larger. This exacerbates one of the reasons why turning keep-alives on can be server performance killer -- if the client sends multiple requests but then doesn't actively close the connection when it's done then the servers will typically set a relatively long timeout before the server will initiate a close() so you get at least two levels of delays. Hope this helps, John

