Configuring Windows for high network connection rates
Configuring Windows for high network connection rates
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 Java Client application normally closes the socket; if the application is on a different machine from the CICS Transaction Gateway, 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. This causes JavaGateway open requests to fail intermittently, and throw a java.net.BindException.
- 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. See the operating system documentation for more details.