Thursday, December 4, 2008

TCP is a risk averse algorithm, it does not simply begin sending data at fill gig speed when a session is established. When a session is initialized the sender has no idea what the network conditions are like between itself and the client, they could be connected with Gigabit interfaces on the same switch, or they could be on a 56k connection in a hotel 1000 miles away. In order to avoid immediately overrunning a network like when a TCP sender wishes to send data it starts by sending a small amount of data, and then for each successful round trip it increases the amount of data send on subsequent round trip.

This behavior is known as slow start, and it allows TCP to gently probe the network and determine how many packets the Server can send at once without causing packet loss. This behavior will continue until the a packet is lost, indicating congestion has occurred, or until the server reaches the maximum receive window that the client is advertising.

The variable that controls the amount of data that can be sent in a round tip is known as the congestion window and is abbreviated cwnd. Modern implementations of slow start initialize the cwnd at two maximum segments. For each acknowledgment that is received the server can send one additional segment in the next flight. If the client acknowledges each segment it receives this will result in geometric growth as the window would double with each round trip. Microsoft Windows uses delayed acknowledgements and will only ack every other packet, and will wait 200ms for outstanding packets if they receive an odd number. So slow start is not geometric, and the window will not double each round trip for windows clients.

Normal Slow Start: 2, 4, 8
Windows Clients: 2, 3, 5, 8