Archive for February, 2007

IIS is holding the MySQL connection

Friday, February 2nd, 2007

TcpTimedWaitDelay

HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Data type Range Default value

Description

Specifies the time that must elapse before TCP can release a closed connection and reuse its resources. This interval between closure and release is known as the TIME_WAIT state or 2MSL state. During this time, the connection can be reopened at much less cost to the client and server than establishing a new connection.

RFC 793 requires that TCP maintains a closed connection for an interval at least equal to twice the maximum segment lifetime (2MSL) of the network. When a connection is released, its socket pair and TCP control block can be used to support another connection. By default, the maximum segment lifetime is defined to be 120 seconds, and the value of this entry is equal twice that, or 4 minutes. However, you can use this entry to customize the interval.

Reducing the value of this entry allows TCP to release closed connections faster, providing more resources for new connections. However, if the value is too low, then TCP might release connection resources before the connection is complete, requiring the server to use additional resources to reestablish the connection.

Notes

Normally, TCP does not release closed connections until the value of this entry expires. However, TCP can release connections before this value expires if it is running out of TCP control blocks. The number of TCP control blocks that the system creates is specified by the value of the MaxFreeTcbs entry.
Windows Server 2003 does not add this entry to the registry. You can add it by using the registry editor Regedit.exe.

Can’t connect to MySQL server(10048)

Friday, February 2nd, 2007

We run Windows IIS + PHP, and we realise that the message Can’t connect to MySQL server(10048) do appear randomly. and we check out “netstat -an”, the port will not connect above 5000

The article Q196271 has solved our problem.

1. Start Registry Editor.
2. Locate the following subkey in the registry, and then click Parameters:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

3. On the Edit menu, click New, and then add the following registry entry:

Value Name: MaxUserPort
Value Type: DWORD
Value data: 65534
Valid Range: 5000-65534 (decimal)
Default: 0×1388 (5000 decimal)
Description: This parameter controls the maximum port number that is used when a program requests any available user port from the system. Typically , ephemeral (short-lived) ports are allocated between the values of 1024 and 5000 inclusive.

4. Quit Registry Editor.

Note An additional TCPTimedWaitDelay registry parameter determines how long a closed port waits until the closed port can be reused.