Available connection adjustment and time_wait tuning under Windows

Source: Internet
Author: User

Friends of the company's products running on the Windows+nginx+tomcat platform, found that a little connection, access to a problem. A large amount of time_wait is also found when viewed through Netstat on the host. On the Linux platform this problem is very good to solve, through the sysctl.conf to adjust the TCP/IP parameters. Windows is confirmed to have similar regulatory mechanisms, called Dynamicportrange.

First, under the windows7/win2008 platform

1, view the number of available ports

Here are the results I looked at under Win7

c:\users\thinkpad>netsh int IPv4 show Dynamicportrange TCP
Protocol TCP dynamic port range
---------------------------------
Boot port: 1025
Number of ports: 13976
Win2008 under the 49152 through 65535, the number of available ports 16,384.

2. Netsh commands modify the number of available ports

netsh int ipv4 set dynamicport tcp start=2000 num=63000
netsh int ipv4 set dynamicport UDP start=2000 num=63000
netsh int ipv6 set dynamicport tcp start=2000 num=63000
netsh int ipv6 set dynamicport UDP start=2000 num=63000
3, time_wait timeout time adjustment

Regedit open the registry and add

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
"MaxUserPort" =dword:0000fffe
"Tcptimewaitdelay" =dword:0000005 (shortened to 5 seconds)
Reference page, Microsoft support page.

Second, Windows xp/win2003

Here are the information found on some Web sites:

Based on a number of sites only prompted the Win2003 available port range, but did not give how to adjust the Win2003 host port adjustment method. Here also through the Microsoft Official Technology station, found the modification method.

1, modify the available port range

Open registry-Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters-Edit new DWORD Value, add MaxUserPort

Value Data:enter A decimal value between 5000 and 65534 here

It is important to note that when the modifications are completed, the host is required to reboot.

2. Modify Time_wait Value

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
On the Edit menu, click New, DWORD Value
Value Name:tcptimedwaitdelay
Value data: <enter A decimal value between Here>
The default value is 240 seconds (the available range is 30-300), after modification to 30 seconds, reboot the system to make the changes take effect

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.