All IT pros need to understand TCP windowing

High-bandwidth replication over long distances, whether to a hot site or the cloud, requires a solid grasp of TCP to steer clear of bottlenecks

1 2 Page 2
Page 2 of 2

The size of the TCP window is variable, which is the key to TCP's ability to deal with congestion on the open Internet. When two network stations start a conversation, the window starts very small (perhaps the size of a single packet, though usually larger). Each time a window's worth of data is sent successfully, the window size is doubled. This process continues until either the maximum window size is reached or packets are lost. If just a couple of packets are lost, the window size is halved, then increased linearly until loss is detected again. This is called congestion-avoidance mode. If a lot of packets are lost in a row, the whole process restarts.

In the Boston-Chicago example, what limited the throughput to 21Mbps? It was the fact that most Windows systems have a default maximum TCP window size of 64KB. If the sending station (your laptop, in the example) has to spend 25ms waiting for an acknowledgement after sending every 65,535 bytes worth of data, 21Mbps is the maximum throughput it can achieve -- regardless of how large the circuit is or whether it's congested. Here's the formula:

[ TCP Window in Bytes ] * 8 / [ Latency in Seconds ] = [ Maximum Throughput in Bits per Second ]

To combat this, the RFC1323 standard defines a method of providing a binary multiplier for the originally 16-bit TCP window size so that TCP windows can be scaled up to 1GB -- providing a large-enough window to easily saturate a 10Gbps Ethernet connection with a single TCP session.

However, this feature, called TCP window scaling, is not always turned on -- though it is usually supported on modern operating systems and networking gear. In the case of Windows Server 2003, you need to manually modify a registry key to raise the maximum TCP window size and thus get any benefit from window scaling. To perfectly use a 500Mbps link with 25ms latency, you need a max TCP window size of around 1,562,500 bytes (about 24 times the Windows 2003 default). Here's the formula:

[ Latency in Seconds ] * [ Desired Throughput in Bits per Second ] / 8 = [ Ideal TCP Window in Bytes ]

Ideally, the window should be rounded to a multiple of the maximum segment size -- typically 1,500 bytes.

Why didn't you already know this?

Most IT pros who aren't networking experts typically don't know the inner workings of TCP. That's usually not a big deal -- when you're working on a LAN with submillisecond latencies or on a WAN with bandwidths of less than 20Mbps, you rarely benefit from changing the default windowing settings. However, it is worth mentioning that the default 65,535-byte window setting on most Windows OSes limits throughput to 524Mbps even with a latency of just 1ms. That means TCP windowing can have an effect on throughput in gigabit LANs -- perhaps best seen during high-throughput, single-connection applications such as backups.

In an age where more and more applications are being moved to the cloud and where WAN connections sport larger and larger bandwidths thanks to fiber, basics such as TCP windowing can make an enormous difference to how well your systems work. Thus, they are suddenly important to IT generalists and networking specialists alike.

If you're not all that familiar with the inner workings of TCP/IP or might not know your way around a protocol analyzer, make a point to learn. You'll at least find it interesting, and chances are it will be valuable to you sooner rather than later.

This article, "All IT pros need to understand TCP windowing," originally appeared at InfoWorld.com. Read more of Matt Prigge's Information Overload blog and follow the latest developments in storage at InfoWorld.com. For the latest business technology news, follow InfoWorld.com on Twitter.

Copyright © 2013 IDG Communications, Inc.

1 2 Page 2
Page 2 of 2