Window 2003 TCP

Source: Internet
Author: User
Tags microsoft website

Recently in the development process, the original well run the program, the following error suddenly occurred:

Net SqlClient Data Provider thrown System.Data.SqlClient.SqlException An error occurred while establishing a connection to the server. When you connect to SQL Server 2005, this failure may be caused by SQL Server not allowing remote connections under the default settings. (PROVIDER:TCP provider, error:0-operation on a socket cannot be performed due to insufficient system buffer space or full queue.)

Errors are frequent and the CPU of the machine is very high.

Analysis:

1, the program has not been changed. Without any on-line.

2, found that the number of IIS links before the increase.

Analysis is due to the increase in Web site traffic, increased IIsWeb Park, but there are still such problems.

When you inquire online, you will not know that Windows 2003 has restricted the number of connections to TCP, which can cause a lack of system buffer space or a full queue error.

After that, increase the number of TCP links and modify the registry as follows:

REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"/V "maxuserport"/d "65534"/t REG_ dword/f
REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"/V "TcpTimedWaitDelay"/"D"/t REG_ dword/f
REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"/V "tcpnumconnections"/"65534"/t reg_dword/f

Original from "Bit net": http://server.chinabyte.com/475/2623975.shtml

Windows provides some way to edit registry parameters to optimize the performance of the TCP/IP protocol. When you change these registry values, you should be aware of its role if you find that these changes fall

Low server performance, should revert to the original settings.

Tip: Some of the registry values described in this article may not exist by default and need to be added manually.

Modifying the registry requires experienced technicians to complete, and incorrect registry modifications can result in severe system instability or failure to start properly, and you should fully understand the role of the registry entry and the possible impact or side effects before implementing registry modifications. It is recommended to visit the Microsoft website or other sites for more information related to registry parameter modifications.

Many registry changes will not take effect until the system restarts, and many changes may limit Windows ' self tuning.

Note: Windows TCP/IP tuning can have a significant impact on memory resources, and it is important to monitor the utilization of memory resources after tuning measures are implemented.

TCP window Size

The TCP receive window (TCP data receive buffer) defines the maximum number of bytes that the sender can send without receiving acknowledgment information. The larger the number, the less acknowledgment information is returned, and the corresponding communication between the sender and receiver is better. A small number can reduce the likelihood that the sender will timeout while waiting for the receiving side to return confirmation, but this increases network traffic and reduces the effective throughput rate.

TCP dynamically adjusts the integer multiples of a maximum segment length MSS (maximum segment size) between the sender and the receiving end. MSS is determined at the beginning of the connection, because the Receive window is adjusted to the integer multiple of MSS, the use of fully-length TCP data segments in data transmission increases, resulting in increased network throughput.

By default, TCP attempts to optimize the window size based on the MSS, starting with a value of 16KB and a maximum of 64KB. The TCP window size can also be manually set in the registry.

The maximum TCP window size is typically 65535 bytes (64KB), the maximum Ethernet segment length is 1460 bytes, and the maximum integer value of 1460 below 64KB is 62420 bytes, so 62420 can be set to the applicable performance optimization values in the high bandwidth network in the registry. This value is not originally in the Registry and needs to be added manually.

The value of the TcpWindowSize registry key can be set at global or per interface level, and the interface level setting overrides the global value. To achieve the maximum window size, we recommend that this be set to the global level.

The registry recommendations are set as follows:

  

Large TCP window and RTT estimation (timestamp)

To make more efficient use of high-bandwidth networks, you can use a much larger TCP window size than the aforementioned TCP windows, a new feature in Windows 2000 and Windows Server 2003, called the TCP Window scaling, which converts the previous 65535 bytes ( 64KB) has been increased to 1073741824 bytes (1GB). With the scaling window, the system allows for the transmission of more data between the messages to be validated, increasing network throughput and performance.

The time required for round-trip communication between the sending and receiving ends is called the loopback time (RTT). TCP has a timestamp option to increase the estimated value of the RTT value by more frequent calculations, which helps to estimate the RTT value of the connection on a longer range of WANs and more precisely adjusts the TCP forwarding timeout time. The timestamp provides two areas in the TCP header, the time a record starts forwarding, and the time that another record receives.

The timestamp is particularly useful for window scaling, which is the large packet transfer before the acknowledgment message is received, and the activation timestamp only adds 12 bytes to the header of each packet, with minimal impact on network traffic. Maximizing data integrity and data throughput is an issue that needs to be evaluated. In some environments, like video streaming, requiring large TCP windows, this is the first important, while data integrity is second, in which case window scaling can not open the timestamp.

This attribute is valid when both the sending and receiving ends activate the window scaling and timestamp.

Initially, a small TCP window is generated, and then the window size is increased according to the internal algorithm.

The relevant registration form is as follows:

  

Note that the low level indicates whether window scaling is turned on and the high level indicates whether the timestamp is turned on.

Table 4 Tcp1323Opts Registry entry

  

After the tcp1323opts is set to activate the TCP window scaling, the value of the registry key TcpWindowSize changes from 65535 bytes to 1GB, and for optimal performance, the value here is best set to a multiple of the MSS.

TCP Connection Forwarding

The number of times to forward a non-confirmed connection request (SYN) before TCP exits is recorded in the registry key Tcpmaxconnectretransmisstions. For each attempt, the forwarding timeout is twice times the successful forwarding. The default timeout in Windows Server 2003 is 2, and the default timeout is 3 seconds (in registry key TcpInitialRtt). The time-out period in a slower WAN connection can be increased accordingly. There may be different optimization settings in different environments that need to be tested in the actual environment.

Note: Do not set the timeout time too large or the network connection timeout will not occur.

  

TCP Data forwarding

The number of TCP forwarding unacknowledged data segments before exiting is recorded in the registry key TcpMaxDataRetransmissions. The default value is 5. TCP establishes an initial interval based on the loopback time of a given connection. Each time the forwarding succeeds, the interval doubles until the response occurs or the timeout occurs, and the interval returns to the initial value.

  

TCP Time Wait delay

By default, TCP locates a port between 1024 and 5000 to provide any available short cycle user ports. When a given communication is closed by TCP, it waits for a period of time before it is released, which is called a delay in time waiting. The default setting for Windows Server 2003 is 2 minutes, which is ideal for most environments. But some busy systems set up multiple connections in a short time, exhausting available ports and reducing network throughput.

Two registry entries:

TCP wait time before TcpTimedWaitDelay release

MaxUserPort the maximum number of ports used by TCP connections

Lowering the latency and increasing the maximum number of ports can increase the system's data throughput rate.

This setting applies to very busy servers, with thousands of concurrent TCP connections, such as a heavily loaded Ldap,ftp,web server.

  

TCP Control block Table

For each TCP connection, the control variable is stored in a block of memory called a TCP control block (TCB). The size of the TCB table is controlled by the registry key MaxHashTableSize. In large systems with many active connections, setting a large table can reduce the time that the system locates TCB tables.

Partitioning on the TCB table can reduce contention for table access. By increasing the number of partitions, TCP performance can be optimized, especially on multiprocessor systems. The registry key Numtcbtablepartitions controls the number of partitions. The default is the square of the number of processors.

  

TCB are usually preset in memory to prevent the TCB from repeatedly relocating when TCP is repeatedly connected and disconnected, which facilitates memory management but also limits the number of TCP connections allowed at the same time. The registry key MaxFreeTcbs configures the number of connections before the TCB of the time wait state is available again. The NT schema is often set above the default value to ensure sufficient preset TCB.

A new feature has been added from Windows2000 to reduce the likelihood of running beyond preset TCB. If you have more connections in the time waiting state than in Maxfreetwtcbs, all connections that are waiting for more than 60 seconds will be forced to close and then enabled again. When this attribute is merged into Windows2000server and Windows Server 2003, MaxFreeTcbs is no longer used to optimize performance.

TCP Acknowledgement Frequency

TCP uses deferred acknowledgement to reduce the number of packets forwarded in the network to improve performance.

Note: This value is configured at the interface level.

The default value is 2,100mbps network use 5 (0x5), 1000Mbps Network (0xD).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.