Dec 19 2008

How to Calculate TCP throughput for long distance WAN links

Published by Brad Hedlund at 3:40 pm under Data Center

So you just lit up your new high-speed link between Data Centers but are unpleasantly surprised to see relatively slow file transfers across this high speed, long distance link — Bummer! Before you call Cisco TAC and start trouble shooting your network, do a quick calculation of what you should realistically expect in terms of TCP throughput from a one host to another over this long distance link.

When using TCP to transfer data the two most important factors are the TCP window size and the round trip latency. If you know the TCP window size and the round trip latency you can calculate the maximum possible throughput of a data transfer between two hosts, regardless of how much bandwidth you have.

Here is how you make the calculation:

TCP-Window-Size-in-bits / Latency-in-seconds = Bits-per-second-throughput

So lets work through a simple example. I have a 1Gig Ethernet link from Chicago to New York with a round trip latency of 30 milliseconds. If I try to transfer a large file from a server in Chicago to a server in New York using FTP, what is the best throughput I can expect?

First lets convert the TCP window size from bytes to bits.  In this case we are using the standard 64KB TCP window size of a Windows machine.

64KB = 65536 Bytes.   65536 * 8 = 524288 bits

Next, lets take the TCP window in bits and divide it by the round trip latency of our link in seconds.  So if our latency is 30 milliseconds we will use 0.030 in our calculation.

524288 bits / 0.030 seconds = 17476266 bits per second throughput = 17.4 Mbps maximum possible throughput

So, although I may have a 1GE link between these Data Centers I should not expect any more than 17Mbps when transferring a file between two servers, given the TCP window size and latency.

What can you do to make it faster?   Increase the TCP window size and/or reduce latency.

To increase the TCP window size you can make manual adjustments on each individual server to negotiate a larger window size.  This leads to the obvious question:  What size TCP window should you use?  We can use the reverse of the calculation above to determine optimal TCP window size.

Formula to calculate the optimal TCP window size:

Bandwidth-in-bits-per-second * Round-trip-latency-in-seconds = TCP window size in bits / 8 = TCP window size in bytes

So in our example of a 1GE link between Chicago and New York with 30 milliseconds round trip latency we would work the numbers like this…

1,000,000,000 bps * 0.030 seconds = 30,000,000 bits / 8 = 3,750,000 Bytes

Therefore if we configured our servers for a 3750KB TCP Window size our FTP connection would be able to fill the pipe and achieve 1Gbps throughput.

One downside to increasing the TCP window size on your servers is that it requires more memory for buffering on the server, because all outstanding unacknowledged data must be held in memory should it need to be retransmitted again.  Another potential pitfall is performance (ironically) where there is packet loss, because any lost packets within a window requires that the entire window be retransmitted – unless your TCP/IP stack on the server employs a TCP enhancement called “selective acknowledgements”, which most do not.

Another option is to place a WAN accelerator at each end that uses a larger TCP window and other TCP optimizations such as TCP selective acknowledgements just between the accelerators on each end of the link, and does not require any special tuning or extra memory on the servers.  The accelerators may also be able to employ Layer 7 application specific optimizations to reduce round trips required by the application.

Reduce latency?  How is that possible?  Unless you can figure out how to overcome the speed of light there is nothing you can do to reduce the real latency between sites.  One option is, again, placing a WAN accelerator at each end that locally acknowledges the TCP segments to the local server, thereby fooling the servers into seeing very low LAN like latency for the TCP data transfers.  Because the local server is seeing very fast local acknowledgments, rather than waiting for the far end server to acknowledge, is the very reason why we do not need to adjust the TCP window size on the servers.

In this example the perfect WAN accelerator would be the Cisco 7371 WAAS Appliance, as it is rated for 1GE of optimized throughput.

WAAS stands for:  Wide Area Application Services

The two WAAS appliances on each end would use TCP optimizations over the link such as large TCP windows and selective acknowledgements.  Additionally, the WAAS appliances would also remove redundant data from the TCP stream resulting in potentially very high levels of compression.  Each appliance remembers previously seen data, and if that same chunk of data is seen again, that data will be removed and replaced with a tiny 2 Byte label.  That tiny label is recognized by the remote WAAS appliance and it replaces the tiny label with the original data before sending the traffic to the local server.

The result of all this optimization would be higher LAN like throughput between the server in Chicago and New York without any special TCP tuning on the servers.

###

61 responses so far

61 Responses to “How to Calculate TCP throughput for long distance WAN links”

  1. Munir K says:

    Hi Brad,

    It is host to host replication and In DC there is only one host which replicates to a host in DR. The only beauty is that every minute around 3 files of 100MB each gets created on DC HOST which needs immediate replication with DR HOST.

  2. Andy says:

    Hi Brad,

    Thanks a lot for your excellent post here.
    I am facing a very critical issue.Need your help(all r welcome to help me)

    I am in China and my company has a WAN link to US (4*T1-Bundled) and then we have a IPSEC tunnel to our Customer network through Internet.We use MRDP to access the Customer’s VM and access some applications.This application is based on Flash and its extremely slow as we are working on MRDP.
    The utilization on our WAN link is not above 30%.
    Latency is 300ms beween the Client and Server.

    Changing the Window size is going to help us
    Most of our desktops in my companies are Vista and i read we can tune the TCP by setting
    netsh int tcp set global autotuninglevel=experimental so that the window size can be upto 16MB.
    After setting this ,we are dont see any performance difference.
    I am really being screwed because of this issue.Kindly suggest a suitable solution.
    I want to know how we can change the Window Size?is it by creating a new Reg Value ?

    These are the parameters on my Windows XP

    MSS: 1440
    MTU: 1480
    TCP Window: 17280 (multiple of MSS)
    RWIN Scaling: 2 bits (2^2=4)
    Unscaled RWIN : 4320
    Recommended RWINs: 63360, 126720, 253440, 506880, 1013760
    BDP limit (200ms): 691kbps (86KBytes/s)
    BDP limit (500ms): 276kbps (35KBytes/s)

    Please help

    Andy

  3. Brad Hedlund says:

    Munir,
    In your case, I would recommend that you look at deploying a Cisco WAAS appliance at each end of the link. The Cisco 3745 router does not support WAAS modules, but I think the performance profile of an appliance would be better for you anyway … such as the Cisco WAVE-674. You can simply place the WAAS appliance inline between your 3745 and LAN switch.

    http://www.cisco.com/go/waas

  4. Munir K says:

    Hi Brad,

    Thanks a lot for this. I have already lined up with Cisco for POC. I will surely share the results with you on this forum.

    Regards,

    Munir K.

  5. Andy says:

    Hi Brad,

    This is continuation of my Previous Post.

    Throughput is RWIN/Latency is Sec

    say I have a 2Mbps link and as per the throughput calulation ,i get a throughput of 1Mbps ,Can i get a trasfer ratefor 1mbps for all file trasfer like FTP traffic,http traffic,MS-DS traffic ,MRDP traffic etc.
    How this can be decided?
    Please help
    I am desperately looking for an Answer…

  6. dheeraj says:

    dear Brad
    i am doing research on multipath routing
    how can we prove that throughput of multipath routing is better than single path routing

    thanks and regards

  7. TQ says:

    Brad Hedlund,
    I just wanted to thank you for your effort in publishing this article.

    Regards

  8. jorge luis obregon says:

    Hi Brad:
    Could you help me with a model that calculated the throughput, included loss. I need a formula for estimated a throughput with loss with the same topology. Please help me if you can.

  9. Brad Hedlund says:

    Jorge,

    I found this formula in my files:

    tcp calc with packet loss

    Hope this helps.

    Cheers,
    Brad

  10. slimer says:

    Brad,

    Thanks for the very interesting explanation here! I have a question and hope you can help.

    We want to perform a data consolidation for some of our application whereby we already know the number of server and we will be able to get the volume of traffic. However, we are not sure how much WAN bandwidth needed in the data center that we will do the data consolidation.

    Let’s say, I have the following parameters:
    - 120GB of aggregated traffic over the LAN (this is the server/client traffic)
    - WAN latency is 75ms (RTD-150ms)

    Objective: To know the WAN bandwidth to be used

    Thanks…Slimer

Leave a Reply