Sunday, July 19, 2009

TCP Optimization for Windows

I have recently been creating nasty batch files to alter default and non-existing networking settings to improve performance on file transfers for replication and came across this awesome tool that is free and does a great job.

We set our MTU to 1350 to take in to account firewall overhead in the vpn mesh. TCP Optimizer is the only tool you need, no installation necessary you just get the .exe to run and it can show you all the settings it is going to change. Highly recommended.

Find your optimum MTU by trying different non-fragmentable pings with specific sizes e.g. ping -f -l 1322 may work where ping -f -l -1323 may not. The highest value you get without an error is what you can use. Don't rely on Wireshark results as it can't tell if your firewall breaks up the packet into small chunks or not when looking at your server's packet trace.

There is a related hotfix for local file copy issues: http://support.microsoft.com/default.aspx?scid=kb;EN-US;920739 for large file (500MB) and greater. This problem occurs when you copy large files locally from a fast disk to a slow disk. For example, this problem can occur when you copy large files from a cluster disk to local system disk.

PSSQL team blog has a nice performance implication of the scalable networking pack that shows it can hinder SQL server performance. http://blogs.msdn.com/psssql/archive/2008/10/01/windows-scalable-networking-pack-possible-performance-and-concurrency-impacts-to-sql-server-workloads.aspx
They mention you will need to disable SNP also which in in this Windows Server 2003 patch http://support.microsoft.com/default.aspx?scid=kb;EN-US;948496 or you can disable EnableTCPChimney, EnableRSS and EnableTCPA.

I found a good article on disabling TCP offloading at a NIC card manufacturer: http://www.alacritech.com/Support/FAQs/DisableOffload.aspx Test to see if helps for large file transfers and you need Windows 2003 SP2 or higher OS. Reboot is not required for this change.  I have attached a vb script that will update the interfaces window size and MTU (1350).  Just for your reference, you could manually find correct NIC interface use this command line to get value from command line:
reg query HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces /f AddressType /s
It creates:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{Some Random GUID Value Here to Identify your NIC}]"MTU"=dword:00000546
My .reg file I use (Descriptions of options are found in this KB: http://support.microsoft.com/kb/314053):
Windows Registry Editor Version 5.00
REM Run this from command line: netsh int ip set chimney disabled
Download: Interfaces.vbs.txt (1.29 KB)

No comments:

Post a Comment