Windows 2000 TCP Performance Tuning tips

Source: Internet
Author: User
Tags rfc
Windows 2000 TCP Performance Tuning tips

Carl Harris

Communications Network servicesvirginia tech

 

I was dismayed by the rather dismal TCP Performance in Win2000, especially for FTP up/downloads to distant sites, where the round-trip time (RTT) is nearly triple-digit. being a Unix bigot of sorts, I also found it amusing to watch my Win2000 machine dribble a download along at 1/6th the speed of my Unix box for the same file, on Network Connections and host systems that are always Ally identical. I wowould have simply filed this away in"Microsoft will never get it right"Folder, but I 've heard from reliable sources that the Win2k TCP/IP stack is largely an adaptation of the TCP/IP implementation in NetBSD -- assuming that's true, given such venerable roots it ought to be able to get much better TCP throughput than I 've observed.

 

I did a little digging around and found the following technet document that describes the TCP/IP implementation in an astonishing level of detail.

 

Http://www.microsoft.com/technet/itsolutions/network/deploy/depovg/tcpip2k.asp

 

(Because Microsoft seems to want to remedy world unemployment by employing armies of people charged with the single task of relocating every document on the Microsoft Web site on an ongoing basis, you can download a copy of a pdf version of this article here .)

 

After reading this document, two things became abundantly clear.

 

1. microsoft has really done a remarkable job. the TCP implementation implements des ally all of the recent extensions to improve performance on long fat Networks -- in which there is plenty of bandwidth but significant round-trip time (RTT ). TCP Window Scaling and timestamps, selective acknowledgement, delayed acknowledgement, as well as other enhancements are all implemented.

 

2. the default parameters for the TCP window size and scaling parameters options are suitable for small 10 Mbps LANs or Internet access where the smallest bottleneck is no more than 2 Mbps. however, for Internet access at 10 Mbps or more, or for 100 Mbps LANs, the default parameters are too conservative, and throughput may suffer.

 

Bottom line, I installed registry parameters to change the TCP window size and to enable the TCP scaling windows and timestamps options (RFC 1323 ). with these new parameters in place (and after the obligatory reboot), My Win2000 box is able to achieve 7 Mbps throughput, downloading large files from well-connected distant FTP sites. previusly, it cocould do no better than about 1.8 Mbps throughput.

 

The parameters I installed go

[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters]

 

The names/values I installed are:

Globalmaxtcpwindowsize

REG_DWORD

131400 (decimal)

Tcpwindowsize

REG_DWORD

131400 (decimal)

Tcp1323opts

REG_DWORD

3

 

These apply only to Windows 2000, as far as I can tell. there are analogous parameters for the window size For WinNT/98/95, but the RFC 1323 options (for Window Scaling, in particle) are not implemented, which means that the maximum feasible window size is 64 KB.

 

The window size parameters represent a nearly eight-fold increase over the default, and shocould be adequate for most 10/100 connected stations communicating over just about any path reachable from the campus. For server systems communicatingLotsOf downstream clients, you may want to be more conservative; with this configuration, every TCP socket will consume at least 128 kb in memory. the RFC-1323 opts parameter must be either 1 or 3 to allow the window size to scale beyond 64 KB. the setting of 3 also enables TCP timestamp headers; this TCP option improves the round-trip delay estimate (improving overall window size dynamics), at the cost of some marginal amount of throughput.

 

So what is the TCP window size thing?

 

The TCP window is the amount of unacknowledged data in flight between the sender and the receiver. data is sent by TCP in segments that are typically 1460 bytes in length. if the sender is permitted a window size of only 1 segment, the sender transmits a single segment, and waits for an acknowledgement from the specified er. if the transmission delay between sender and receiver er is long, this means very low throughput (very few segments transferred per unit time ). both sender and receiver er spend most of their time waiting for messages to be transmitted from one end of the connection to the other.

 

In order to improve throughput, the sender transmits multiple segments without waiting for the next acknowledgement from the aggreger. the TCP window is an estimate of the upper bound on the number of segments that will fit in the length of the pipe between sender and receiver er. the window size is increased during a TCP transfer until the end-to-end path becomes too full (indicated by a segment being dropped somewhere in the Network ), then the size is backed off and then increased slowly again until the limit is reached. this cycle of shrinking and slowly expanding window size continues throughout the TCP connection. in this way, TCP tries to optimize the transmit window to Maximize throughput over the lifetime of the connection. the specified er advertises his maximum window size to give the sender an idea of how much buffer space the specified er has available. this puts a hard limit on size of the window, even if more bandwidth is available in the network.

 

If the pipe is pretty big, and the round-trip delay is long, a lot of segments will fit in the network between the sender and receiver er.

The window size needs to be pretty big in a long, fat network. How big?

 

Window size = bandwidth * Delay

 

For 10 mbps bandwidth and a round-trip delay of 0.010 sec, this gives a window size of about 12 KB (or nine 1460-byte segments ). this shoshould yield maximal throughput on a 10 Mbps LAN, even if the delay is as high as 10 MS -- most LANs have round-trip delay of less than a few milliseconds. when bandwidth is lower, more delay can be tolerated for the same fixed window size, so a window size of 12 kb works well at lower speeds, too.

 

For a fixed window size, large increases in bandwidth mean that small increases in round-trip delay will have a significant effect on throughput. if the end-to-end bandwidth is 100 Mbps, A 12 kb window size implies that no more than 1.05 MS of delay is tolerable if TCP throughput near 100 Mbps is desired -- that's a pretty tight bound, even for a LAN.

 

The default maximum TCP window size in Win2000 is 17520 bytes (12 segments ). this shoshould work nicely in LANs -- even at 100 Mbps -- assuming that end-to-end delay is not much more than 2 ms. the default window size shoshould yield TCP throughput of around 70 Mbps on a 100 Mbps LAN, assuming congestion is minimal. this default Max TCP window size is also large enough for Round Trip delays of 70 MS and end-to-end bandwidth of up to 2 Mbps. that's no coincidence; most entities on the Internet have access pipes that are T1 (1.5 Mbps) or E1 (2 Mbps) and the nominal round-trip delay coast-to-coast in the U. s. is about 70 ms. so, as a first cut at a reasonable default setting for the TCP Max window size, this ain't too bad.

 

But what if you have a WAN connection with nominal 10 mbps bandwidth available, and you're downloading from a distant, well-connected server. perhaps you're on the US east coast, and you're downloading from a West Coast server. the typical delay in this case is about 85 Ms. in order to get 10 Mbps throughput over a connection with 85 MS round trip delay, the TCP window will need to be at least 100 kb. if the delay varies by as much as 20 MS, you'll need about 128 kb in the window.

 

The parameters I chose provide a maximum TCP Window of 90 1460-byte segments (about 128 KB ). this window size shocould be able to compensate for as much as 105 MS delay, and still deliver 10 Mbps throughput, assuming that packet loss due to congestion is low.

 

Is this a bad thing to do? If everyone sets their TCP window size at 128 kb and thus has the potential to get 10 Mbps throughput on downloads should ss a substantial chunk of the Internet, you might be thinking that bad things might happen. TCP is smarter than that. the window size advertised by the specified er is just an upper bound. the sender increases the size of the transmit window slowly, and uses packet loss as the indication that the transmit window is too big. thus, when there are lots of senders, each will see proportionally less bandwidth available for transmit window expansion, and throughput for each will be proportionally lower. this happens with always Ally no adverse affect on the network.

 

Is this going to "hurt" performance for connections with much lower delay (e.g. In the LAN )? The round trip time (RTT) plays a crucial role in determining the rate of growth of the window. even though a runner er might advertise a large maximum window size, the TCP Slow Start ensures that the sender won't try to put that much data in flight before received ed acknowledgements start providing a good estimate of the RTT, hence the length of the pipe, hence the number of segments that shocould be kept in flight.

 

The only remaining issue is whether the allocation of 128 kb buffers for each TCP socket poses a significant threat to system performance. given a 128 MB system that is behaving mostly as a client, it's unlikely that memory resources are tight enough to warrant much concern there. you'll want more memory for socket buffers if you plan to do this on a server that has lots of concurrent connections on the network.

 

Copyright 2001, Carl Harris, Jr.

Ceharris@vt.edu

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.