Windows: Advanced TCP/IP Networking settings – Increasing performance of network traffic

Hey guys,

So if your like me your always looking for way to move data faster. I’ve recently upgraded my internet to 300 mbit’s and I was like why is my PC still going so slow?

Well low-n-behold Microsoft is intentionally throttle network speeds in Windows. So below is a write-up of what was found, this information was found piece together from numerous technet postings, from past posting that I created on techexams.net, notes from phone calling with Microsoft SQL support, and other bloggers, but mainly this was all stuff I had to do myself back in 2011 when I worked for a large manufacturer. This could adversely affect database servers connecting to application servers, as an example, as this is what it was affecting me back in those days on a custom Manufacturing ERP that worked with SQL 2003 and highly specialized Windows XP and Vista PC’s.

When I used to work at President Container Group back in 2011 I had dealings with networking protocols that used things like unicast, multicast, and sockets for communication between PLC’s, PAN’s and highly specialized ERP/CRM applications. In my travels while working at this company we ran into instances where performance was limited in Windows XP and Vista at the time and the problem followed suit thru to Windows 7 when we upgraded in 2013.

What many people don’t know, is that there is a limitation on the number of sockets per Windows Machine and also there is limitations placed on the Winsock kernel to throttle connections. Think about it, it’s now 2017, desktops have Quad and higher core counts, but back in 2003 when Windows XP was big CPU cycles just weren’t there to meet the speed of networks. So Microsoft throttled the connections to meet the needs of the masses.

After taking the Cisco exams and getting more in-depth with network after reading the book in the fall of 2010 called “The All New Switch book” I learned about the inner workings of TCP/IP. When I was tasked by my boss in 2011 to figure out why we had a 10G network but the Windows XP boxes were going so slow comparable to the network speeds, I took my hunt to a forum called Technet. Thru the advice from that forum and from another forum called Techexams.net answers and suggestions were thrown my way and after countless calls to Microsoft, we found hidden settings in all flavors of Windows: XP, Vista, Windows 7, Windows Server 2003, Windows Server 2008.

Below we will talk about 3 things you can do to fix these problem: 1) TCP Receive Windows thru “Receive Window Auto-Tuning, 2) Increasing default send and receive TCP socket buffers, and 3) enabling CTCP.

Let’s begin: 🙂

TCP Receive Windows:

As mentioned above, Microsoft limited the specifications of the Winsock kernel going back as far as LANMAN has been used in Windows. It was never really a concern until companies start reallt pushing data faster than operating systems were designed to move them. One of them is the TCP Receive Window, which is limited to 64KB’s by default but can scale to 8MB on demand. Their is also a TCP Send Window but no one really bothers with that one much, but I do.

Many people think of IP address as a IP address, and Ports like telnet is port 22 as just a port, however when a port is mapped to a local PC’s IP address, this is essentially called a socket. A PC can have multiple connections from many different kinds of neighbors in a subnet all using the same port thus a different socket is created for each instance. However, even if you have a different socket for each instance they still all default to the default windows winsock packet size.

You have to remember, most of these winsock settings leading up to Windows 7, were still basing a network as being a 10BaseT network, so 64KB is appropriate. But now networks have grown to 100BaseT, 1000baseT, and 10000base, some cases even higher, yet the winsock still has it throttled at 10baseT speeds. In order to increase speeds and throughput on these boxes, you can do three things.

  1. Disabled TCP Receive Window Auto-Tuning
    1. If you disabled it, windows will not go above 64KB
  2. Enable TCP Receive Window Auto-Tuning
    1. If you enable it, it will grow from 64KB to the max of 8 MB
  3. Manually increase the TCP Receive Window (discussed below in next article)

Here is what you need to do:

1.Disable TCP Receive Windows Auto-Tuning

  1. Open elevated command prompt with administrator’s privileges.
  2. Type the following command and press Enter:
    netsh interface tcp set global autotuning=disabled

2. Enable TCP Receive Windows Auto-Tuning

  1. Open elevated command prompt with administrator’s privileges.
  2. Type the following command and press Enter:
    netsh interface tcp set global autotuning=normal

 

Increasing Send and Receive Buffers Manually (special circumstances)

Once you have the TCP Receive Window tuned, you might still have a bottleneck in the Winsock layer. I have found that configuring Winsock manually, in special circumstances, makes a huge difference for download/upload speeds. Microsoft has acknowledged a bug in the TCP autotuning for non-blocking sockets — just the kind of socket that browsers use 😉

The default BDP packet sizes with autotuning disabled is 64k, the maximum size is 8 MB (8096 KB)

The following commands do require you to edit the Windows Registry, so please make a backup of the your registry before continuing. After you make these changes you will also need to do a reboot. The Send Window, as shown below, is used in your upload cache.

Add DWORD key for DefaultSendWindow and set it to the BDP or higher. I am using 256000, but start with 10240, and then 16384. After you apply then, restart the PC and see if it helps. Adjust accordingly. I just love tweaking Windows… 🙂

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\AFD\Parameters\DefaultSendWindow

Changing the Winsock setting for downloads might help for thinks like YouTube caching, email caching, or file transfers  – add a key for DefaultReceiveWindow.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\AFD\Parameters\DefaultReceiveWindow

Compound TCP:

Compound TCP (CTCP) is a Microsoft algorithm that was introduced as part of the Windows Vista and Window Server 2008 TCP stack. It is designed to aggressively adjust the sender’s congestion window to optimise TCP for connections with large bandwidth-delay products while trying not to harm fairness. It should be enabled in-sync with Autotuning and when you increase the socket buffers. By default, it’s disabled in most desktop O/S’s, but enabled on most servers.

Solution – Enable CTCP and ECN on your network connection

Windows Vista/7 by default CTCP and ECN are disabled on supported versions of Windows Vista and Windows 7. To enable these features please do the following:

1. Open an Elevated Command Prompt (cmd “Run as Administrator”)
2. In the Elevated Command Line, Type the Following Commands
3. netsh interface tcp set global ecncapability=enabled

4. netsh interface tcp set global congestionprovider=ctcp

Reboot your system for the changes to take effect

After reboot, open an elevated command line and type the following command:

netsh interface tcp show global

In the list you should see the items below

ECN Capability -“Enabled”
Add-On Congestion Control Provider-CTCP

If yours match, your done. enjoy yourself

How to revert settings back to default

If you ever need to disable these settings simply open an elevated command line and type:

netsh interface tcp set global ecncapability=disabled
netsh interface tcp set global congestionprovider=none

Then Reboot your system.

Conclusion:

Recently, had to do these settings for my own PC at home when I enable 10G on my gaming PC and I remembered I did something like this 6 years ago and it’s a good thing I keep notes of all of the things I ever do, so I had to look thru them all, and I found these in the notes.  What’s funny in Windows 10 now, you can still set these settings for even more speed! .. Good times Microsoft, those times in my early 20’s are nights I’ll never get back trying to figure out why a large SQL file would crash the connection on the Vice President Windows Vista Laptop remotely…

As always, if you guys want other registry hacks and tweaks, here are some other articles created over the years, some of them are done, others are like have eat cookies with wordings I never got done doing cause I got distracted in the lab, but lol here they are:

  1. https://www.g15it.com/windowsvmware-tweaking-windows-server-physical-virtual-perform-10g-network/
  2. https://www.g15it.com/windows-forestdomain-performance-policy/
  3. https://www.g15it.com/group-policy-management-essential-performance-and-security-settings/