Calculate the optimal TCP window scale value

Introduction

The window size in a TCP connection is a very important parameter. It has a huge influence on the performance because the receive window is the amount of data a host can accept without acknowledging the sender. If the sender has not received acknowledgement for the first packet it sent, it will stop and wait and if this wait exceeds a certain limit, it may even retransmit. If the receive window is too small, a server will wait very often. If a window is too big, chances are higher that a server will send too fast and packet loss will happen.

Bandwidth-delay product

The optimal value for the receive window is often called the bandwidth-delay product. It is the amount of data that can be sent over a link during the time the server sends the first packet and the time the server receives an acknowledgement for this packet.

So:

Bandwidth-delay product = RTT x BandWidth

Now, to optimize the TCP performance, the calculated optimal receive window should be at least this size and a multiple of the MTU of the link. But there is also a third important parameter: TCP, the receive window is announced by two parameters: the window size in the TCP header, and if supported, the window scale factor.  This means the ideal receive window must be a value that can be expressed by a window size and scale value.

Spreadsheet tool

To calculate the optimized value for a TCP connection, we have created a spreadsheet where you can just enter the different parameters, and you will get the optimal values for both the announced window size and windows scale.


TCPWindowScaling.xlsx
xlsx