TCP time_wait and port exhaustion for servers

Ray Soucy rps at
Thu Dec 6 17:18:17 UTC 2012

This issue is for really for connections that close properly and
without any issue.

The application closes the socket and doesn't care about it; but the
OS keeps it in the TIME_WAIT state as required by the RFC for TCP in
case data tries to be sent after the connection has closed (out of
order transmission).

I think we're going to go with dropping it to 30 seconds instead of 60
seconds and seeing how that goes.  It seems to be the direction taken
by people who have implemented high traffic load balancers and proxy

I was hoping someone would have real data on what a realistic time
window is for keeping a socket in a TIME_WAIT state, but it doesn't
seem like anyone has collected data on it.

On Thu, Dec 6, 2012 at 11:33 AM, Jean-Francois Mezei
<jfmezei_nanog at> wrote:
> Question:
> If a TCP connection is left hanging and continues to hoard the port for
> some time before it times out, shouldn't the work to be focused on
> finding out why the connection is not properly closed instead of trying
> to support a greater number of hung connections waiting to time out ?

Ray Patrick Soucy
Network Engineer
University of Maine System

T: 207-561-3526
F: 207-561-3531

MaineREN, Maine's Research and Education Network

More information about the NANOG mailing list