Skip to content

Configuring Windows for high network connection rates

23 November 2010

When a TCP/IP socket is closed, it goes into TIME_WAIT state before closing, for a period of time determined by the operating system. A socket in TIME_WAIT state cannot be reused; this can limit the maximum rate at which network connections can be created and disconnected.

The client application normally closes the socket; if the application is on a different machine, the limitation usually applies to the machine running the application. The symptoms of a machine that is reaching these limits include:

All of the TCP/IP resources of the operating system are in use, and requests for new connections fail. Running the netstat -a command on the application machine shows a large number of sockets in TIME_WAIT state.
Performance deteriorates.

To improve the ability of the Windows operating system to deal with a high rate of network connections, add the following registry entries in

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters

TcpTimedWaitDelay
A DWORD value, in the range 30-300, that determines the time in seconds that elapses before TCP can release a closed connection and reuse its resources. Set this to a low value to reduce the amount of time that sockets stay in TIME_WAIT.

MaxUserPort
A DWORD value that determines the highest port number that TCP can assign when an application requests an available user port. Set this to a high value to increase the total number of sockets that can be connected to the port.

For example, a system making a large number of connection requests might perform better if TcpTimedWaitDelay is set to 30 seconds, and MaxUserPort is set to 32678

Advertisements

From → networking

Leave a Comment

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: