Troubleshoot Time_wait and Close_wait methods under Windows

Source: Internet
Author: User

Methods for modifying the time_wait parameters (modified on the server side)
Under Windows in Hkey_local_machine/system/currentcontrolset/services/tcpip/parameters, add the name TcpTimedWaitDelay
DWORD key, set to 30, to shorten the wait time for time_wait


Workaround for Close_wait: (Modified at client)
1 The general reason is that the TCP connection does not call the Close method. Needs to be applied to handle network link shutdown.
2 This is the reason for Web requests, often because response's bodystream did not call close.
For example, under Widnows:
Use HttpWebRequest Make sure that the GetRequestStream and GetResponse objects are closed, otherwise it is easy to cause the connection to be in the close_wait state
3 TCP keeplive function, can let the operating system for us to automatically clean off the close_wait connection.
However, Keeplive is 7,200 seconds under the Windows operating system, or 2 hours to clean it up. Often does not meet the requirements. The value can be adjusted smaller.
The adjustment method under Windows is
The following three parameters under Hkey_local_machine/currentcontrolset/services/tcpip/parameters:
KeepAliveInterval, set its value to www.2cto.com
KeepAliveTime, set its value to 300000 (in milliseconds, 300000 for 5 minutes)
TcpMaxDataRetransmissions, set its value to 5
Issues raised by close_wait:
Close_wait will take up a connection and the network can have a small connection. Too many, may cause network performance degradation, and occupy the system non-paged memory. Especially in the case of a connection pool (e.g. HttpRequest)
The number of network connections that will drain the connection pool, causing the network connection to not be established


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]


"KeepAliveTime" =dword:006ddd00
"KeepAliveInterval" =dword:000003e8
"MaxDataRetries" = "5″

Troubleshoot Time_wait and Close_wait methods under Windows

Related Article

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.