The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,402 other followers

TIME_WAIT and MaxUserPort – what it is, what it does, when it’s important – Blog du Tristank

Posted by jpluimers on 2018/08/01

Despite many posts saying you can use it on other than outbound connections, lets quote that it doesn’t:

MaxUserPort controls “outbound” TCP connections

[WayBackMaxUserPort is used to limit the number of dynamic ports available to TCP/IP applications.

It’s never going to be an issue affecting inbound connections.

MaxUserPort is not the right answer if you think you have an inbound connection problem.

Source: [WayBackMaxUserPort – what it is, what it does, when it’s important – Blog du Tristank

The side of the TCP connection that closes is gets the TIME_WAIT state, which means you should avoid your server to terminate connections because it then will run out of available ports. Clients should disconnect when done (or when done for the foreseeable future) otherwise the server gets the 2MSL TIME_WAIT penalty as for instance explained by [WayBack] TIME_WAIT and its design implications for protocols and scalable client server systems – AsynchronousEvents.

The solution for inbound connections is that your TCP based protocol should enforce either the client to close the connection, or to use some form of client pooling so there is no need for many connection setup/teardowns of short lived connections.

TIME_WAIT can last for about ~10 minutes if you are unlucky.

More recommended reading:

–jeroen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: