This is a fallicy: opening more connections will *not* get you higher performance; if anything, you will get worse performance; the multiple connections can
havoc with TCP's congestion control measures.
The highest TCP performance is seen using a single TCP connection.
http://www.google.com/url?sa=t&ct=res&cd=4&url=http%3A%2F%2Fwww.sigcomm.org%2Fsigcomm97%2Fpapers%2Fp102.pdf&ei=dNvYRMK3LMa4avS
4pPwH&sig2=csgWnYb9mZpXdC3Y0PVunw
AFD Parameters
Afd.sys is the kernel-mode driver used to support Windows Sockets applications.
DefaultReceiveWindow
The number of receive bytes that AFD buffers on a connection before imposing flow control. For some applications, a larger value here may give a sligtly better
performance at the expense of increased resource utilization. Applications can modify this value on a per-socket basis.
Registry Location:
HKLM\SYSTEM\CurrentControlSet\Services\Afd\Parameters
DefaultReceiveWindow (DWORD, not present by default. Recommended: leave blank as is, since this value limits the TCP/IP TcpWindowSize RWIN value)
DefaultSendWindow
Same as the above setting for the send side of connections.
Registry Location:
HKLM\SYSTEM\CurrentControlSet\Services\Afd\Parameters
DefaultSendWindow (DWORD, not present by default. Recommended: leave blank as is. Alternatively, you can enter a value up to the
TCP/IP TcpWindowSize RWIN setting)
Datagram Size
MS Windows supports a fast I/O path which is utilized when sending "small" datagrams (packets). The default setting for what is considered "small" datagram
is 1024 bytes; increasing this value to match your network MTU (normally 1500) can significantly improve network performance.
To adjust this parameter:
HKLM\SYSTEM\CurrentControlSet\Services\AFD\Parameters
FastSendDatagramThreshold=1500 (DWORD value, 1024 by default when not present, recommended: 1500 decimal)
Note: setting not in the current version of the TCP Optimizer.
FastCopyReceiveThreshold
When an application posts a receive with a buffer that is smaller than the current packet being buffered by Winsock, AFD can either make an additional copy of
the packet and then copy data to the application buffers directly (two-stage copy because application buffers cannot be accessed directly under the lock), or it
can lock and map application buffers and copy data once. This value represents a compromise between extra code execution for data copying, and extra code
execution in the I/O subsystem and memory manager.
To adjust this parameter:
HKLM\SYSTEM\CurrentControlSet\Services\AFD\Parameters
FastCopyReceiveThreshold=1500 (DWORD, 1024 by default when not present, recommended: 1500 decimal)
IgnorePushBitOnReceive
Setting this parameter to 1 causes Afd.sys to treat all incoming packets as though the push bit was set. We recommend leaving this at the default of 0 (disabled).
Registry Location:
HKLM\SYSTEM\CurrentControlSet\Services\AFD\Parameters
FastCopyReceiveThreshold (DWORD boolean, 0 by default when not present, recommended: don't set)
References: Technet
Web Patch
According to the HTTP specs, only limited number of simultaneous connections are allowed, while loading pages. To increase that number in Internet Explorer, you can add the following
entries to the Registry (they are not present by default). For Firefox, refer to our browser tweaks article.
HKEY_USERS.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings
"MaxConnectionsPerServer"=dword:00000010
"MaxConnectionsPer1_0Server"=dword:00000010
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
"MaxConnectionsPerServer"=dword:00000010
"MaxConnectionsPer1_0Server"=dword:00000010
Notes: Keep in mind that increasing those values exceeds the HTTP specs. Increasing them much over 10 may cause problems with some websites. While these entries might improve web
page loading considerably, they tend to strain webservers more and have no effect on throughput.
Alternatively, you can download a patch (sguide_webtweak_2k) that will add these entries for you automatically from the Downloads section of our site.
Windows 2k/XP - More Tweaks
2001.03.31 11:10 EST by Philip
You can find our main Windows 2000/XP tweaks and patches here: Windows 2k/XP Registry Tweaks
On this page, you will find additional tips and tweaks for improving your network performance and broadband experience with Windows 2k/XP.
This page is provided as a supplement of our Registry Tweaks articles. Here you will find more advanced information on implementing the same tweaks,
methods for determining MTU, BDP and RWIN calculations, as well as other suplemental relevant information.
Determining your ISP's MTU
The TCP packet size, or the Windows Registry "MaxMTU" value you should use is limited by your ISP's MTU value, since all packets will be traveling through their equipment. To determine
the MTU of your ISP, try the following:
In Dos Prompt(Command Prompt), type:
ping -f -l [packetsize] [www.yourisp.com] where [packetsize] is the amount of data you want to send ( between 0 and 1500 bytes ) and [www.yourisp.com] is your ISP's URL (you can also
use your gateway, or any server your connection always passes through instead of your ISP's URL).
The largest value that does not give you the error "Packet needs to be fragmented, but DF set" will be your ISP's MTU - 28 (excluding the IP [20 bytes] and ICMP [8 bytes] headers). Use the
following table to interpret the number you received and determine your ISPs MTU:
Note: All this can be also determined automatically by using our SG TCP Optimizer program, freely available for download in the Dwonloads area of the site.
Finding the right "000n" Folder in Windows 9x
If you have multiple devices that use TCP/IP, you will have multiple "000n" folders in the Registry, under HKLM\System\CurrentControlSet\Services\Class\Net\Trans
If you add the MaxMTU value to all "000n" folders with "TCP/IP" to the DriverDesc setting, chances are you will slow down your dial-up modem connection a bit ( since its optimal
MaxMTU is still 576, rather than 1500 ).
In order to determine which is the right one for entering the MaxMTU value, you can use any one of the following methods:
1. Open Regedit, and navigate to HKLM\System\CurrentControlSet\Services\Class\Net\Trans\000n\Ndi You can modify the "HelpText" value to be any text value you wish. If you give each
000n folder a unique "HelpText" value, you can then distinguish between them all when you go to Network Properties and check the Description field for each TCP/IP binding.
2. Right-click on "Network Neighborhood" and choose "Properties". Find TCP/IP that's bound to the NIC you use with the Cable Modem/DSL. If it has a static IP address, you can look for
that under
HKLM\System\CurrentControlSet\Services\Class\Net\Trans\000n
When you look in the right "000n" folder you will find a string value called "IPAddress" with the same IP assigned to it. At this point, you can add MaxMTU only to that folder. Note: If you
have multiple NICs bound to TCP/IP, you might want to add MaxMTU to them as well, that way your LAN will benefit from the tweaks too.
3. You could also delete all but one adapter that uses TCP/IP from "Control Panel > Network". Note that before doing that, you should write down the settings of these adapters and the TCP/IP
they bind to, since you will have to re-enter them later. Once you've deleted the unnecessary adapters, reboot and you will be left only with one "000n" folder ( that has "TCP/IP" assigned to
DriverDesc ) in your Registry. At this point, add the MaxMTU to this folder and re-add the adapters you erased in the previous step.
Internet Connection Sharing in Windows 98SE
Seems with the introduction of Internet Connection Sharing (built-in NAT solution in Win98SE), Microsoft added another entry for MTU. You will need to change this, in order to optimize
throughput:
HKLM\System\CurrentControlSet\Services\ICSharing\Settings\General\ "internetMTU"=1500
Bandwidth*Delay Product and the TCP Receive Window
The Bandwidth*Delay product (BDP) determines the maximum amount of data that can be in transit in the network. It is directly related to the Maximum TCP
Receive Window (RWIN) value that should be used when tweaking your internet connection. Throughput can not exceed the BDP and the TCP Receive
Window (RWIN) needs to be large enough to fit the BDP.
With that in mind, here is the BDP formula:
BDP = bandwidth * latency
or,
BDP(bytes) = total_available_bandwidth(KBytes/sec) * max_round_trip_time(ms)
Essentially, the BDP depends on the maximum available bandwidth multiplied by the latency/delay/ping value.
RWIN (the TCP Receive Window) is the TCP buffer that determines how much data can be in transit in the network, just as the BDP. It should be big enough to
accomodate BDP. In addition, the TCP specs, and related RFCs also introduce a few notable considerations for calculating an optimal RWIN value summarized
below:
1. Early TCP specs (before RFC 1323) allowed for only 16 bits in headers for the RWIN value, limiting it to 16KB (65535).
2. Related RFCs recommend the value to be multiple of the MSS (packet size without headers, usually MTU - 40 bytes of TCP and IP headers).
3. Above 65535 (The maximum possible unscaled RWIN value), the TCP Window is calculated by multiplying the unscaled RWIN by a scale factor that's
multiple of 2. This scale factor is stored in the TCP Options RFC1323 header extension.
4. RWIN should be calculated based on the maximum anticipated (not current) latency.
5. Even with large RWIN values, the unscaled RWIN should remain a high number for backwards compatability with legacy routers.
6. A RWIN value that's too large may perform poorly in the presense of packet loss. Even though it does not "cause" packet loss, the older congestion control
TCP algorithms slow down recovery. Those algorithms, however have been superceeded by CTCP in Windows Vista/2008 (and 2003/XP64 with hotfixes).
With all those points in mind, calculating the optimal RWIN value is a bit more involved than just plugging any number in the Windows Registry. Below is a
good way to accomplish this in 3 steps:
1. Determine MSS (displayed by the SG TCP Analyzer), maximum anticipated latency and advertised maximum bandwidth.
(for example, 1460 MSS, 300ms max latency, 6Mbit/s max bandwidth).
2. Find the optimal unscaled RWIN value (largest even multiple of MSS less than 65535):
65535 / 1460 (MSS) = 44.9
round down to even number = 44
44 * 1460 (MSS) = 64240 (this is the optimal unscaled RWIN value)
3. Multiply the unscaled RWIN by 2 until the result is close to/larger than the BDP.
Our BDP for 6Mbps @ 300 latency is:
6000 kbps * 300ms = 1800000 / 8 = 225000 bytes
64240 (unscaled RWIN) * 2 * 2 ... = 256960 (number larger than BDP, this is the optimal RWIN)
Note that the above calculations are already implemented in both the TCP Analyzer and the TCP Optimizer. The BDP can also be easily determined using our
online BDP Calculator.
UDP Packet Size
UDP over IP has a total header length of 32 bytes (12 bytes for UDP, and 20 bytes for IP).
To change the UDP packet size, in the Windows Registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS\Parameters
MaximumUdpPacketSize=512 (DWORD, default value is 1280 bytes. Must be a number between 512 and 16384)
Recommended values: between 512 and 1468.
Note: When you configure the UDP packet size, remember that UDP packets must travel through different devices that may not support large UDP packets.
Some network equipment cannot handle packets larger than 1468 bytes, particularly under heavy load.
Windows 2003 TCP/IP parameters
Windows 2003 Server-specific broadband related registry settings
2007.12.12 12:12 EST by Philip
Windows 2003 SP1 and SP2/R2 (as well as Vista/2008) introduce some interesting new NDIS 6.0 hardware features to improve network performance. The
parameters discussed below intended as an addition to our recommended XP/2003 network settings. Most of those parameters are new, introduced with the
"Scalable Networking Pack".
TCP Chimney Offload
TCP Chimney Offload is an extesion of NDIS 5 offloading, and makes it possible for network cards to replace the Windows TCP stack with their own
implementation. The TCP connection state, once established is transfered to the NIC miniport driver, which then completely handles the traffic between teh
application and the remote host. In essence, the NIC miniport driver provides a "chimney" from the top to the bottom of the TCP stack.
TCP Chimney offload improves the performance of long-lived connections with large-sized payloads, such as data streaming and large file transfers.
To enable Chimney Offload, in command prompt:
netsh interface tcp set global chimney=enabled
Or, in the Windows Registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
EnableTCPChimney=1 (1=enabled, 0=disabled)
Notes: TCP Chimney offload is disabled automatically in the presense of a software firewall (Windows Firewall), ICS (Internet Connection Sharing), IPsec,
IPNAT.
Receive-side Scaling
Enables use of multiple CPUs to handle received packets (where the NIC spreads the load to available CPUs).
To enable/disable RSS, in command prompt:
netsh interface tcp set global rss=enabled
In the Windows Registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
EnableRSS=1 (1=enabled, 0=disabled)
Notes:
RSS should not be activated if using ICS (Internet Connection Sharing), or ISA server. More info: MS KB 927695, MS KB 927168
TCP Acceleration (TCPA)
To enable TCP Offloading support (TCPA), in the Windows Registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
EnableTCPA=1 (1=enabled, 0=disabled).
Notes: TCPA should not be activated if ISA server is enabled.
Also see: MS KB 947773
Network Direct Memory Access (NetDMA)
NetDMA minimizes the CPU processing needed to move packets between memory buffers. It has some hardware requirements, such as INtel I/O Acceleration
Technology (Intel I/OAT) available with Xeon processors to function. NetDMA will not work together with "TCP Chimney Offload" and requires "Receive-
side Scaling". Windows chooses NetDMA if it detects that both NetDMA and TCP Chimney Offload is supported.
NetDMA will be disabled automatically in the presense of a software firewall, ICS, IPsec, IPNAT.
Compound TCP (CTCP)
Compound TCP is a newer congestion-control algorithm available in Vista, 2008 Server, and via hotfix in 2003 Server, or even XP (64-bit). CTCP is a
considerable improvement over the traditional slow-start and congestion-avoidance methods, especially over high-speed internet connections. CTCP attempts to
maximize throughput by monitoring delay variations and packet loss. It also ensures that its behavior does not impact other TCP connections negatively. We
highly recommend enabling this setting.
For Windows 2003/XP, to set CTCP, in the Windows Registry, navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
TCPCongestionControl=1 (DWORD value, 1=enable, 0=disable)
Recommended: enabled
See also:
MS KB949316 - Hotfix for Windows 2003 Server and XP (64-bit).
MS KB947775 - Hotfix for Windows 2003
Checksum Offloading
This NDIS 5 setting allows for reducing CPU load by offloading some tasks required to maintain the TCP/IP stack to the network card. Theoretically, Widnows
should automatically detect capable network hardware.
The tasks offloaded are as follows:
- TCP/IP checksum calculation - each packet sent includes a verification checksum.
- TCP/IP segmentation - also known as "TCP Large Send" where Windows sends a large amount of data to the network card, and the NIC is then responsible
for dividing it according to the network MTU. Experimental feature, not enabled by default
- IPSec Encryption cyphers and message digests - provides encryption of packets at the hardware level.
To change the checksum offloading in the Windows Registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
DisableTaskOffload=0 (DWORD value, 0=enable offload, 1=disable offload, default not set)
Recommended: leave at default unless experiencing problems.
Note: Checksum offloading should not be activated together with the Windows Firewall.
Also see: MS KB 888750, MS KB 904946, MS KB 936702
References
MS KB 912222 - The Microsoft Windows Server 2003 Scalable Networking Pack release
MS Whitepaper - Introduction to the Windows Server 2003 Scalable Networking Pack
The Cable Guy - Scalable Networking Pack
LAN Tweaking
2005.03.15 13:02 EST by Philip
The following tweaks are focused towards increasing local network performance under Windows XP/2k/2k3 Server. They can be used in addition to all the
broadband tweaks, if you are on a LAN. All information in this article presumes some proficiency in editing the Windows Registry. Even though we extensively
test all our tweaking recommendations, use of the below information is at your own risk.
Disable Network Task Scheduler
(LAN Browsing Speedup)
This tweak disables searching networked computers for scheduled tasks. It reduces the long wait when opening network folders. To apply this tweak, find the
following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RemoteComputer\NameSpace\
and delete this key:
{D6277990-4C6A-11CF-8D87-00AA0060F5BF}
Here are registry files you can merge to directly apply/undo this tweak:
sg_lan_speedup.reg
undo_sg_lan_speedup.reg
Note: You might want to export the key before deleting, then to revert the changes, simply merge your exported reg file.
Removing the second sub-key in HKLM\.....\NameSpace that looks like: {2227A280-3AEA-1069-A2DE-08002B30309D} disables checking for network printers.
Increase Request Buffer Size
(reduce network delay)
In higher latency Network environments, delays may be encountered with the default request buffer size (4356 decimal). The range of this parameter is 1024 -
65535 bytes. Testing has shown that, in most standard Ethernet environments, 16384 (decimal) is a better choice, if memory is available. This tweak only
applies to LANs, and helps with slow browsing of large directories.
To change this setting, edit:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters and Add Value name SizReqBuf as a type REG_DWORD,
increase its (decimal) value to 16384 or even higher and restart the computer for changes to take effect.
Here is the MS KB Article 320829 that describes the procedure as well.
Increase Network Redirector Buffers
(better network performance)
If you increase the number of network redirector buffers it may considerably increase your network throughput. Each extra execution thread that you configure
will take 1K of additional nonpaged pool memory, but only if your applications actually use them.
To configure additional buffers and threads, edit: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanWorkstation\Parameters Modify or
Add Value of type REG_DWORD for:
MaxCmds=dword:00000064 - range is 0 - 255 and the default value is 15. Set to a higher number, try 64 for starters.
MaxThreads=dword:00000064 - set to the same value as MaxCmds.
MaxCollectionCount in the same key is a DWORD buffer for character-mode named pipes writes. You might want to increase it from te default 16 as well, its'
range is 0 - 65535.
No shares in my My Network Places
Speed up Windows Explorer and network browsing by stopping automatic shares in "My Network Places"
By default, Windows 2k/XP/2k3 tries to read icon information from shortcuts in the "My Network Places" folder, accessing remote files on the network, and
causing a very slow system response. Every time you open a file in a remote shared folder, or a file via a UNC name, Windows will automatically add another
shortcut to "My Netowork Places", making the problem worse with time. To resolve this:
Navigate to:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer and add a new DWORD value:
NoRecentDocsNetHood=1 (set it to 1 to disable remote shared folders from being added to Network Places).
Depending on your OS, it might also be possible to modify this by accessing the Group Policy Object Editor. To use this method to achieve the same effect:
- Go to Start > Run > type: gpedit.msc
- In the GPOE, navigate to: User Configuration > Administrative Templates > Desktop > Enable "Do not add shares of recently opened documents to My
Netowrk Places"
Notes:
The above might also work by adding the same key to the HKLM Registry hive here, but we have not tested it:
HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoRecentDocsNetHood=1 . The MS Group Policy Editor adds the entry
to HKEY_CURRENT_USER.
For additional info, see: MS TechNet - NoRecentDocsNetHood