Compartir a través de


Quick Figuring Optimal TCP Window Size

There generally isn't a single correct way to figure out the optimal TCP window for an interface since you're probably connecting to different hosts across different links at different latencies; however, you can roughly guess what the optimal window would be if you're only primarily worried about your communication with one other host (or, perhaps, one other site).  First, you'll need to know the latency and the throughput available between you & the remote host.  To get the latency, ping the remote host and take the average response time.  For the throughput, take the slowest link between you & the remote host (ie, you might both be connected to 100Mb/s Ethernet, but there is a 1.5Mb/s WAN link between).  If the slowest link is asymmetrical, use the faster of the two speeds -- for example, on an ADSL connection that was rated as 1.5Mb/s down and 384Kb/s up, use the 1.5Mb/s speed.  (If both ends are on DSL, use the lower speed as this will always be the limiting factor.)

Once we've got these two numbers, the normal formula used to calculate optimal TCP window is bandwidth * latency = window.  Remember that throughput is measured in bits per second whereas our TCP window is going to be configured in bytes per second.  Divide the throughput by 8 to convert bits per second to bytes per second.

So, if we were using a 1.5Mb/s ADSL link with 70ms of latency, our calculation would look something like this:

(1.5*1024*1024/8)bytes/second * .07seconds = ~13763bytes

So, on this link, a 13KB TCP window would work well.  Since the default TCP window for Windows 2000/XP/2003 is 16K (or more), there would be no need to change the window on this client; however, if either the throughput or the latency was higher, we would probably benefit from a change.

Comments

  • Anonymous
    October 27, 2004
    The comment has been removed
  • Anonymous
    October 27, 2004
    Glad you found it useful! I'd like to start getting more network-oriented stuff out here...