Tuning of the TCP window size is based on a number of factors, including network link speed and network latency. For our purposes relating to PlateSpin products, the initial choice of TCP window size for tuning is based on standard calculations (widely available on the Internet and elsewhere) as follows:
WinSizeInBytes=((LINK_SPEED(Mbps)/8)*DELAY(sec))*1000*1024
For example, for a 54 Mbps link with 150 ms latency, the proper initial window size would be:
(54/8)*0.15*1000*1024 = 1,036,800 bytes
For a 1000 Mbps link with 10 ms latency, the proper initial window size would be:
(1000/8)*.01*1000*1024 = 1,280,000 bytes
In order to get a latency value for the network, use ping from the command prompt (Windows) or the terminal (Linux). Although the ping round-trip time (RTT) is arguably different than the actual latency, the value obtained is sufficiently close for use in this method.
The following is a sample output from a Windows ping command, where the latency is observed to be 164 ms on average:
ping 10.10.10.232 -n 5 Pinging 10.10.10.232 with 32 bytes of data: Reply from 10.10.10.232: bytes=32 time=154ms TTL=61 Reply from 10.10.10.232: bytes=32 time=157ms TTL=61 Reply from 10.10.10.232: bytes=32 time=204ms TTL=61 Reply from 10.10.10.232: bytes=32 time=153ms TTL=61 Reply from 10.10.10.232: bytes=32 time=153ms TTL=61 Ping statistics for 10.10.10.232: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 153ms, Maximum = 204ms, Average = 164ms
The following is a sample output from a Linux ping command, where the latency is observed to be 319 ms on average:
ping 10.10.10.232 -c 5 PING 10.10.10.232 (10.10.10.232) 56(84) bytes of data. 64 bytes from 10.10.10.232: icmp_seq=1 ttl=62 time=0.328 ms 64 bytes from 10.10.10.232: icmp_seq=2 ttl=62 time=0.280 ms 64 bytes from 10.10.10.232: icmp_seq=3 ttl=62 time=0.322 ms 64 bytes from 10.10.10.232: icmp_seq=4 ttl=62 time=0.349 ms 64 bytes from 10.10.10.232: icmp_seq=5 ttl=62 time=0.316 ms --- 10.10.10.232 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3998ms rtt min/avg/max/mdev = 0.280/0.319/0.349/0.022 ms
In practice, you should use the -n or -c option to specify a larger number of ping packets in order to more closely measure the latency value.