Saturday, April 28, 2012

Tuning Windows Server 2003 TCP/IP Stack

Most of this tuning tips were fetched from Microsoft's "Performance Tuning Guidelines for Windows Server 2003" and from IBM's Redbook guide on "Tuning Windows 2003 Server", already tested by me on several scenarios. Basically, this tweaks are for most common scenarios, but you can do further optimization if you starting sniffing your network with WireShark or Microsoft's Network Monitor and analyzing the behavior of your server.

Allow larger TCP Window Size in Ethernet connections, improving performance on transmission of larger files:
reg add HKLM\System\CurrentControlSet\Services\tcpip\Parameters
/v TCPWindowSize /t REG_DWORD /d 0xFAF0 /f

Allows Windows Scaling negotiation and dynamic increase and decrease of TCP Window size (info):
reg add HKLM\System\CurrentControlSet\Services\tcpip\Parameters
/v TCP1323Opts /t REG_DWORD /d 0x3 /f

Reduces to 30 seconds, the time where the socket connection is in "TIMED_WAIT" state (info):
reg add HKLM\System\CurrentControlSet\Services\tcpip\Parameters
/v TCPTimedWaitDelay /t REG_DWORD /d 0x1E /f

Increases the number of TCB (TCP Control Blocks), allowing a better system performance when having a high value of TCP connections (info):
reg add HKLM\System\CurrentControlSet\Services\tcpip\Parameters
/v MaxHashTableSize /t REG_DWORD /d 0x10000 /f

Increases the number of allowed user ports (origin ports), preventing port exhaustion (info):
reg add HKLM\System\CurrentControlSet\Services\tcpip\Parameters
/v MaxUserPort /t REG_DWORD /d 0xFFFE /f

Increases the number of TCB partitions, for better management of TCP connections on Multi processor machines (info):
reg add HKLM\System\CurrentControlSet\Services\Tcpip\Parameters
/v NumTcbTablePartitions /t REG_DWORD /d 0x4 (multiply by the number of processors)

Aldo, this tweak requires to manually identify the GUID of the network interface, it allows you to increase the number of TCP packets before a TCP.ACK is issued, therefore reducing some overhead with TCP connections (info):
reg add HKLM\system\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\[interface GUID]
/v TcpAckFrequency /t REG_DWORD /d [Appropriate interface type value]

The values corresponding to the interface types are:
  • 0xD for Gigabit Ethernet
  • 0x5 for Fast Ethernet

To find out the GUID of the interfaces on the servers, first, query the existing interfaces with:
reg query HKLM\system\CurrentControlSet\Services\Tcpip\Parameters\Interfaces

...then you must query each interface to get the "right one" (you can easily identify it by the IP assigned):

Kwaheri (Sahili, google it...)

1 comment:

  1. I read few articles on this site and I think that your web blog is real interesting and Power to the People of excellent information.
    Cara alami Menyembuhkan kutil di kemaluan / kondiloma manjur