TCP/IP RWIN Auto-Tuning can slow down network

The network protocol stack has been rewritten in Windows Vista, so it will be even better at adapting to high performance network connections. It is no longer possible to specify a custom size for the TCP/IP Receive Window (RWIN) with the new auto tuning feature (Unless the application it self uses SO_RCVBUF).

Vista enables Receive Window Scaling by default and when performing the handshake, then it uses a RWIN of 256 bytes with a scale factor of 8 (256^2*8=64K bytes). This allows the RWIN to reach the size of 16,776,960 bytes.

Sadly enough not all remote hosts understands the scale factor, and some broken routers might even rewrite the scale factor to zero as packets passes through. Instead of negotiating a RWIN of 65536 bytes then it is only uses 256 bytes. This causes a very slow start or that the connection is dropped completely.

It possible to change the way it automatically tune the RWIN, so it will use a RWIN of 16,384 bytes with a scale factor of 2 (16384^2*2=64K bytes). This allows the RWIN to reach the size of 262,140 bytes.

netsh interface tcp set global autotuninglevel=highlyrestricted

Note one can disable the autotunning completely, and lock the RWIN to 65536 bytes:

netsh interface tcp set global autotuninglevel=disabled

More Info MS KB929868
More Info MS KB932170
More Info MS KB935400
More Info MSDN - WSAIoctl function controls the mode of a socket
More Info The Cable Guy - TCP Receive Window Auto-Tuning
More Info The Cable Guy - Next Generation TCP/IP Stack

Related Enable auto-tuning of RWIN in Internet Explorer

Credits www.petri.co.il

Updated: 5 September 2015

Comments:

  1. j7n says:

    I hear about compatibility of autotuning with "routers" but I cannot understand it. How can a router react to the receive window if all it does is pass on a packet, optionally adjusting it's src-/dst-address and header checksum if NAT is enabled. How do RWIN or RFC 1323 come into play here?

    1. Snakefoot says:

      The broken routers will set the scaling-factor to zero on the the SYN packets as they pass through. So the router breaks the RWIN-negotiations with the remote host. Will update the article about this to make it more clear.

Leave a Reply

Your email address will not be published. Required fields are marked *