TCP/IP ???????? ???????? ???? ?? ?????? SQL ????? ??????? ????? ???? ?? ??? ???? ??? ?? ???? ?? ?? ?? ?????

???? ?????? ???? ??????
???? ID: 328476 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

?? ????? ??

??????

SQL ????? ODBC ???????, SQL Server OLE DB ???????, ?? System.Data.SqlClient ???????? ??????? ?????? ?????, ?? ?? ??????? ?????? ????????? ???????????? ??????? (APIs) ?? ????? ???? ?????? ?? ????? ?? ????? ?? ?? ?????? ?? ?????, stress ?????????? SQL ????? ??????? ????????? ?? ?? ???? ?? ?? increased ??? ???? ????????? ????? ????? ?? ?? ??????? ??? ?? ???? ??? ?? ???? ????? ???? ?? ?? ?? ?????? ?? ??? ???????? ???? ?? ??? ???? ??? ?? ???? ?? ??? TCP/IP ?????????

???? ???????

?????? ?? ??? ???? ?? rapidly ????? ?? SQL Server ??? ??? ???????? ?? ??? ?? ????? ??????? ?? ??? ???? ?? ??? ?????????? SQL ????? ??????? ??????? ???? ?? ???? ???? ???? ???????? ?????? ?? ???? stress ???? ?? ??? ??? ???? ?? ??? SQL Server ??? ??? ???????? ?? ??? ??????? TCP/IP ????? ???????? ????????? ???? ??? ???? ???

????? ??? ?? ?? ???? ?? ????? ???? ???? ???????? SQL ????? ??????? ????????? ?? ???????? TCP/IP ????????? ?? ????? ???? ??? ???? ?????? ??? ???? ?? ?? ???? ??? stress ?? ??????? ???????? ???? ????? ?????? ???? SQL Server ????????? ?? ??? ??, ????? ?? ???? ?? ???? ?? ????? ???? ??? ?? ???? ???? ????? ???????????? ?? ??? ??? ??? ?? ?? ???? ??? ???? ???? ???, Microsoft ??????? ???? ?? ?? ?? TCP/IP ????? ?? ???? ??? ?? ????? ???????? ??????

??? ???? ?? Microsoft ?????? ???? ?? ?? ????? ????? SQL Server ??????? ?? ??? ?????? ??? ?? ????? ???? ??? ?? ?????? ????? ??????????? ?? ??????? ?? ??????? ???? ?? SQL ????? ?? ??? ????? ?? SQL Server ????????? ?? ????? ????? SQL ????? ?? ??? ?? ?? ???????? ?? ??? ??????? ???????? ????? ?? ?? ???? ?????? ?? ????? ?? ??? ??? ?????? ?? ???, ?? ????? ??????? ??????? ????? ?? ?? ????? ?????? ?? ??? ??? 20,000 SQL ????? ?? ????? ???? ?? ????? 160 ???? TCP/IP ??????? ?????, ??????? ??????? ?? 23,520 ?????? ?? ??? ???? ?? ???? ?????? ????? ???? ??? ??, ??? ?? ????? ??????? ????? 225,129 TCP/IP ??????? ?????, ??????? ??????? ?? 27,209,622 ?????? ?? ??? ???? ?? ????

????? ??? ?? ?? ?? ?? stress-??????? TCP/IP ????? ???????? SQL ????? ??????? ????????? ?? ?????, ?? ?? ???? ?? ???? ????? ?????? ??????? ??? ?? ?? ?? ???? SQL Server ??? ??? ???????? ?? ?????? ???? ?? ?????? ???? ???:
SQL ????? ????? ???? ?? ?? ?????? ????? ??
???????? ???????
??????? ??????? ??????
TCP ???????: ???????? ????? ??? (?????????/??????? ???/?????) ?? ????? ?? ???? ?? ??????? ??? ?? ?????? ???
??? ???? ?? ?? ?? ??????? ?? ???? ?? ??????? ?????? ????? ?? SQL ????? ?? ??? ???? ???????? ??????? ?? ??? ???; ?????? ?? ???, ?? ???? ?? ???? ????? ?????? ????? ??? SQL ????? ?? ??? ?? ?? ?????? ???????? ?? ??? ????, ??? SQL ????? ?? ??? ?? ?? ?????? ???????? ???? ??? ??? ?? TCP/IP ????? ???? ?? ??? ??, ??? SQL Server ??? ??? ???????? ?? ??? ??????? ??????????? ??? ?? ??????? ??????? ???? pulled ?? ???? ??, ?? ??? DNS ??????????? ????? ???? ???? ???? basically SQL Server ??? ??? ???????? ?? ??? TCP/IP ????? ????? ?? ??? ???? ???? ?? ??? ??????? ???? ?? ???? ??? ?? ??? ?? ?? ???? ??? ?????? ?????? ???????, stress-??????? ????? ??? ?????? ?? ??? ?????? ???? ?? intermittently stress rises ?? ??? ?? ??? ???? ???????? ??? ???? ???? ?? ??? ??? ????????? ?? ???, ?? ?? ?? ?? ??? ?? ???????? ???? ?? ?? ???? several ?? ??? ???? ???? ???? ????????? ?? ??? ??????? ??, ?? ???? ??? ?? ?????? ??, ??????? ??????????? SQL ????? ?? ??? ?? ?????? ??? ???? ??, ???? ???? ???? ??, ?? ??? ???: ???? ?????? ??? ????? ????? ?????? ???, ????? stress-??????? ?????? ?????????? ?? sporadically, ????? ???????? ??????? ??????????? SQL ????? ?? ??? ?????????? ???? ???????? sporadically.

?? ?? ????? stress-??????? ?????? ?????????? ???? ?? ?? ?? SQL Server TCP/IP ????????? ?? ????? ???? ??? ?????? ?? ????? ????: ?? ?? ???? ??? ?? ???? ????? ??????? ???????? ??, ?? ?? ???????? ??? ?? ???? ?? ???? ??WinsockListenBacklogSQL Server ??? ??? ???????? ?? ??? ?? ??? ???

???? ????? ?? ???? ??? ???????? ??????? ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
319502PRB: 'WSAEADDRESSINUSE' ?????? ????? ?? ?? IMAP ??????? ???? ????? ?? ???? ????? ?? ?????? ???? ?? ??? ?????? ???? ?? ???

MaxUserPort ?? TcpTimedWaitDelay ???????? ???????? ????

?? ???MaxUserPort, ??TcpTimedWaitDelay???????? ?? ???? ??????? ???????? ?? ?? rapidly ??? ??? ?? ?? ?? SQL ????? ?? ??? ?? ?? ?? ?? ???? ????? ??????? ?????? ???? ?????? ???????? ?? ??????? ??? ???? ?? ??? ???? ???? ?????? ?? ???, ?? ???????? ??????? ?????????? ???????? (IIS) ????? ?? ???? ?????? ??? ??? ???? HTTP ?????? servicing ?? ?? ?? ??? ??? ?? ?? ?? SQL ????? ?? ??? ?? ?? ?? ????? ?????? ?? ??? TCP/IP ????????? ?? ????? ?? ?? ?????? ???????? ?? ??????? ??? ???? ?? ??? ?? ?? ???? ???? ???? ?????? ????? ???? ??? ??, ??? ???? ??? ???? ???????? ???? ?? ???MaxUserPort, ??TcpTimedWaitDelay????????.

SQL ????? ?? ??? ?? ?? ???? ???????? ?? ??? ??? ??????? ????? ?? ??? ?? TCP/IP ????????? ?? ????? ????, ?? ?????????? SQL ????? ??????? ????????? SQL Server ??? ??? ???????? ?? ??? TCP/IP ????? ????? ??? ?? ?? ????? ????? ??, ?? SQL ????? ??????? ????????? ?? ????? ???? ????SO_REUSEADDRTCP/IP ????? ??????? ?? ???? ??? ???? ??????? ?? ???SO_REUSEADDR?????? socket ??, "Setsockopt" ???? ??? Microsoft ?????? ??????? (MSDN) ??????

????? ??? ?? SQL ????? ??????? ????????? ????? ??? ?? ????? ???? ????SO_REUSEADDR??????? ?????? ?? TCP/IP ????? ??????? ??SO_REUSEADDRis enabled, a malicious user can hijack a client port to SQL Server and use the credentials that the client supplies to gain access to the computer that is running SQL Server. By default, because the SQL Server network library does not enable theSO_REUSEADDRsocket option, every time you open and close a socket through the SQL Server network library on the client side, the socket enters a TIME_WAIT state for four minutes. If you are rapidly opening and closing SQL Server connections over TCP/IP with pooling disabled, you are rapidly opening and closing TCP/IP sockets. In other words, each SQL Server connection has one TCP/IP socket. If you rapidly open and close 4000 sockets in less than four minutes, you will reach the default maximum setting for client anonymous ports, and new socket connection attempts fail until the existing set of TIME_WAIT sockets times out.

On the client side, you may have to increase theMaxUserPort, ??TcpTimedWaitDelaysettings that are discussed in Q319502 when you have pooling disabled. The settings for these values are determined by how many SQL Server connection opens and closes occur on the client side. You can examine how many client ports are in a TIME_WAIT state by using the Netstat tool on the client computer. Run the Netstat tool with the-nflag as follows, and count the number of client sockets to your SQL Server IP address that are in a TIME_WAIT state. In this example, the IP address of the remote computer that is running SQL Server is 10.10.10.20, the IP address of the client computer is 10.10.10.10, and three established connections and two connections are in a TIME_WAIT state:
C:\>netstat -n

Active Connections

  Proto  Local Address         Foreign Address       State
  TCP    10.10.10.10:2000      10.10.10.20:1433      ESTABLISHED
  TCP    10.10.10.10:2001      10.10.10.20:1433      ESTABLISHED
  TCP    10.10.10.10:2002      10.10.10.20:1433      ESTABLISHED
  TCP    10.10.10.10:2003      10.10.10.20:1433      TIME_WAIT
  TCP    10.10.10.10:2004      10.10.10.20:1433      TIME_WAIT
				
If you runnetstat -nand you see that close to 4000 connections to the IP address of the target computer that is running SQL Server are in a TIME_WAIT state, you can both increase the defaultMaxUserPortsetting and reduce theTcpTimedWaitDelaysetting so that you do not run out of client anonymous ports. For example, you can set theMaxUserPortsetting to 20000 and set theTcpTimedWaitDelaysetting to 30. A lowerTcpTimedWaitDelaysetting means that the sockets wait in the TIME_WAIT state for less time. A higherMaxUserPortsetting means that you can have more sockets in the TIME_WAIT state.

Note that if you adjust theMaxUserPort??,TcpTimedWaitDelaysetting, you must restart Microsoft Windows for the new setting to take effect. TheMaxUserPort, ??TcpTimedWaitDelaysettings are for any client computer that is talking to a computer that is running SQL Server over TCP/IP sockets. These settings do not have any effect if they are set on the computer that is running SQL Server unless you are making local TCP/IP socket connections to the local computer that is running SQL Server.

???:If you adjust theMaxUserPortsetting, we recommend that you reserve port 1434 for use by the SQL Server Browser service (sqlbrowser.exe).??? ???? ???? ?? ???? ??? ???? ????? ?? ???, ????? ???? ?????? ?? ????? ?? ???? ?? Microsoft ???????? ??? ?????::
812873Windows Server 2003 ?? Windows 2000 ????? ??? ??? ???????? ?? ephemeral ????? ?? ?? ?????? ??????? ???? ?? ??? ???? ????

WinsockListenBacklog ?????? ???????? ????

?? SQL Server-??????? ????????? ?????? ?? ???? ??? ???????? ??????? ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
154628INF: SQL ????? ?????? TCP\IP ??????? ?????? ?? ??? 17832
SQL ????? ??????? ????????? TCP/IP ????? ?? ????? ??, ?? SQL ????? ??????? ????????? ?? ??????????Winsock API. ????? ???????? ?? ????????API ?? backlog ?? ?? ????? ?? ??? ?????? ?? ?? ??? ?? backlog ?????? ?? ??? ??????? ????? ?? ?????? ?? ?????? ????? ?? ???????????? ???? ??? ?????????? ?? ?????? ????? ?? ?????? ????? ?? ???? ?? ??? ??, ?? SQL ????? ??????? ????????? ????? ?? ?? TCP/IP ????? ??????? ??????? ??? ??, SQL ????? ??????? ????????? ACK + ????? ????? ???? ????? ?? ???

??? ??????? SQL Server 2000 ????? ????? 5 ??? ?? backlog ?????? ??? ???? ???? ?? ?? SQL ????? ?? ??? ?? ?? ???????? passes 5 backlog ???????? ?? ??? ?? ????????Winsock API ???????API ?? SQL Server ??? ??? ???????? ?? ??????? ??? ??? ?? TCP/IP ????????? ??? ???? ??? ?? ???????? ?? ??? ??? ???? ?? ??? ????? ??? ?? ????????? ???? ?? ??? WinsockListenBacklog ????????? ????? ?? ???????? ?? ???? ???? SQL ????? 2005 ??? ??????? ????, ??????? ????????? passes SOMAXCONN ?? ??? ??? ?? ??? backlog ?????? ?? ??? ????????API. SOMAXCONN ?? ?????? ?? ??? ?? ???? ?????? ??? ?? ??? ???? ?? ??? Winsock ??????? ?? ?????? ???? ??? ?????, WinsockListenBacklog ????????? ????? ?? ?? ????? ?? SQL Server 2005 ??? ?????? ???

????? ?? ??????????? ??? backlog: Suppose arbitrary ???? ???? ??? TCP/IP ????? ?????? ?? ??? ??? ??? ??? ??? 5 ?? ??? backlog ?????? ??? ?? ?? ?? ????? ??????? ?????? ??? ?????? ?????????? ???, ?? ???? ???? ?? ???? ?? ??? ???? ?? ??? ??? ????? ?? ??? ??? ?? ??? ???????? ?? ???????? ???? ??? ?????? ?? ????? ??, TCP/IP ????? ??? queues backlog ???? ??? ?? ??? ??????, ?? ???? ?? ??? ??? ???????? ?? ?????? ?? ??? ?? ????? ?? ??? ??????? ?????? ?? ???? ?? ???? ???? ?????????? ?????? ???? ??, ?? ??? TCP/IP ????? ??? ????? ?? ?? ??????? ?? ?? ACK + ????? ????? ????? ??? ??? ?? ???????? ????? ??????? ??????? ????? ????? ??????? ?? ?????? ?????? ???? ?? ?? ?????? ?? ???????? ???? ?? ???? TCP/IP ????? ??? queues backlog ???? ???? ?????? ???

?? ???WinsockListenBacklog?????? SQL ????? ?? ??? ??????? ??? SQL ????? SQL ????? ???? ???? ??????? ???? ?? ?? ?? ????????? ?????? ?? ????? ?? ?????? ???? ??? ??? ?????? ????? ???? ??, 5 ?? ??????? ?? ????? ???? ???? ??? ??? ????????? ?????? ????? ??, SQL ????? ?????? ???? ?? ?? ??? ??? TCP/IP ????? ??????? ??????? ??? ??? ?? WinSock API ????? backlog ?????? ?? ??? ???? ???? ?? ?? ??? ??? ???? ??? ??? ?? ????? ???? SQL ????? ?? ?????

????????? ???? ??? ?? ?? ?????? ??? ??? ??? ???, ?? ?? ???? ??? ??????? ?? SQL Server ??? ??? ???????? ?? ??? ??????? ?????? ????? ?? ????? ?? ????? ??????? ?????? ?? ????? ACK + ????? ?? ???????? ???? ?? ??? ?????? ??? ?? ??????? ?????? ??? TCP/IP ??????? ?? ???? ????, ?? ?? ??? ???? ?? ????? ????? ???? ?? ?? ?????? ??????? ?? ??? ??:
Frame: Base frame properties
ETHERNET:  EType = Internet IP (IPv4) 
IP: Protocol = TCP - Transmission Control; Packet ID = 40530; Total IP Length = 40; Options = No Options
TCP: Control Bits: .A.R.., len:    0, seq:         0-0, ack:3409265780, win:    0, src: 1433  dst: 4364 
  TCP: Source Port = 0x0599	
  TCP: Destination Port = 0x110C
  TCP: Sequence Number = 0 (0x0)
  TCP: Acknowledgement Number = 3409265780 (0xCB354474)
  TCP: Data Offset = 20 bytes
  TCP: Flags = 0x14 : .A.R..
    TCP: ..0..... = No urgent data
    TCP: ...1.... = Acknowledgement field significant
    TCP: ....0... = No Push function
    TCP: .....1.. = Reset the connection
    TCP: ......0. = No Synchronize
    TCP: .......0 = Not the end of the data
  TCP: Window = 0 (0x0)
  TCP: Checksum = 0xF1E7
  TCP: Urgent Pointer = 0 (0x0)
				
??? ???? ?? ????? ????? 0x599, ?? ????? ??? 1433 ??? ?? ?????? ?? ????? SQL ????? ?? ?? ?? ??? ?? ?? ???? ??????? ???????? ?? ??? ?? ?? 1433 ?? ??????? ????? ?? ?? ??? ??? ?? ?? ????????????? acknowledgement ?????????????? ?? ????? ????????? ??? ???? ??? ?? ???? ??????? ?????? ????? ????????? ?? ?????? ???, ?? ?? ???? ACK + ????? ????? ??????? ?????? ????? ??? ????? ?? ??? ???????????? 0x14 ?????? TCP ???? ??? ?????? ?? ???? ????

??? ???? ?? ?? ?? ??? ???? ??? ???? ACK + ????? ????? ??? SQL Server ??? ??? ???????? ?? ??? ?? ???? ?? ?? ??? SQL Server ??? ??? ???????? ???? ??? ??? ?? TCP/IP ????????? ?? ??? ???? ACK + ????? ????? ?? ??? ???? ?? ????? ?????? ?? ?? ???? ?? ?????? ???? ???? ???WinsockListenBacklog???? ?? ??, ???????? ?? ??????? ???? ??? ??? ??????? ??????? ????? ?? ??? ??????? ????? ??????? ACK + ????? ????? ??? ?? ?? timeframe.

Note that in very rare cases, you may have to adjust this setting even if pooling is enabled on the client computers. For example, if many client computers are talking to a single computer that is running SQL Server, a large number of simultaneous incoming connection attempts may occur at any particular time even if pooling is enabled.

???:If you adjust theWinsockListenBacklogsetting, you do not have to restart Windows for this setting to take effect. Just stop and restart the SQL Server service for the setting to take effect. TheWinsockListenBacklog???? SQL Server ??? ??? ???????? ?? ??? ????????? ?????? ??? ?? ???? SQL Server talking ?? ?? ??????? ???????? ?? ??? ?????? ???? ???

???

???? ID: 328476 - ????? ???????: 04 ?????? 2010 - ??????: 2.0
???? ???? ???? ??:
  • Microsoft SQL Server 2000 Standard Edition
  • Microsoft ADO.NET 1.1
  • Microsoft SQL Server 7.0 Standard Edition
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Enterprise Edition
  • Microsoft SQL Server 2005 Express Edition
  • Microsoft SQL Server 2005 Workgroup Edition
??????: 
kbinfo kbmt KB328476 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:328476

??????????? ???

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com