There are a few very useful online calculators that help network administrators. I would like to share one that I found recently that I hope you can benefit from too.
The SG RWIN/BDP Calculator is a tool provided for quick calculation of approximate RWIN (TCP Window) values using the BDP (Bandwidth*Delay Product). See also What is the Bandwidth – Delay Product. One of the really helpful pieces of information in the BDP hyperlink just mentioned is the quote “Keep in mind in data communication 1 kilobit = 1000 bits, while in data storage 1 Kilobyte = 1024 Bytes. The TCP Window values in the Windows Registry (and in Linux /proc/sys/net/core/…) are in bytes.”
The SG TCP Analyzer is a hosted web-based tool that provides packet header information from the TCP 3-way handshake between your computer and the host server. The information returned from the tool output can be used to fine-tune TCP/IP settings and optimize your internet connection. This calculator may no longer be as relevant for Vista and Windows 7 machines since the TCP/IP protocol stack on those operating systems attempt to automatically adjust the tcp window size on the fly. And it is even less relevant for users behind NAT routers because the router is end-point for the tcp conversation over the internet and therefore you need to tune the window size on the router instead of the client. Also, routers must be appropriately sized to handle the amount of bandwidth that you are trying to push through them.
So how can you test whether your TCP/IP Window size is optimal and whether your ISP is providing you with the bandwidth you are paying for? For internet connections under 10mb, using online web-based tools like the two listed in the table below. For connections over 10mb, using a tool like iPerf (described below) is the only reliable method that I have found.
For example, my TimeWarner cable internet connection at home can get about 10mb down and 0.4 mb up.
But for businesses that have connections faster than 10mb, those online web-based tools are not as reliable for a variety of reasons that go beyond the scope of this blog entry. I was skeptical of these reasons at first, and found it easier to simply suspect that my ISP had oversubscribed their bandwidth (which is the dirty secret in the Telcom industry (read here and here). However, the iPerf tool is an objective test of true throughput at speeds higher than 10mb. iPerf is handy because it is a single binary executable that can be quickly downloaded and launched without a lengthy installation process.
When using iPerf, you need two machines; one to function as a server and the other to function as a client. When running as a client with the –c parameter, the upload speed is tested. So, for my home internet connection, the screen shot below shows that I got 425 Kbits/sec with the default TCP window size of 8 Kbyte and 428 Kbits/sec when the TCP window size was set at 512 Kbyte by the iPerf –w parameter. With the –w parameter, you can continually test until you find the maximum bandwidth that the connection permits. In the test below, I was behind a NAT router and so the variance between 425 and 428 Kbits has nothing to do with the window size because my router is the TCP endpoint. The only way to truly test ideal window size is to plug your computer directly into the ISP connection to eliminate the NAT translation. For sake of brevity I will skip the screen shot of the download speed with iPerf.
Ok, so now that we can see how iPerf handled a slow internet connection, let’s see how it really shows up those web-based tools on a 100mb internet connection.
The first thing you’ll notice is that of the two web-based tools, neither report anything higher than 43mb down, and 8mb up. And the Speedtest.net connection test was woefully underreporting the bandwidth. If left with these tests alone, which on the surface seem accurate enough (especially after having just validated my home connection against iPerf) we would immediately suspect that our ISP was not giving us the full 100mb that we were paying for. This is where a tool like iPerf can really help that this is not always the case, and that the web-based testing tools are not reliable for connections beyond 10mb.
In the screenshot below, I setup an iperf at our data center to listen for connections with iperf (-s) while one of our branch offices connected running iperf –c (client). The test copied 112 megabytes of data and confirmed a 93 megabit transfer rate. Close enough to 100mb, and I’ll write the lost 7mb to TCP overhead. This is a much better story than the web-based tools that showed we were only getting 8mb and 3mb, respectively!
In the screenshot below, I reversed connections and had the client upload data and got a 90mb transfer rate when the window size was set to 512 Kbyte.