Illustrated TCP/IP Illustrated TCP/IP
by Matthew G. Naugle
Wiley Computer Publishing, John Wiley & Sons, Inc.
ISBN: 0471196568   Pub Date: 11/01/98
  

Previous Table of Contents Next


Chapter 203
Slow Start and Congestion Avoidance

Other features of TCP are the slow start and congestion avoidance mechanisms. Original versions of TCP would start a connection with the sender transmitting multiple segments into the network, up to the window size advertised by the receiver (set up during the three-way handshake). Local subnets were not affected as much as communication between subnets. If there are routers and slower links between the sender and the receiver, problems can arise. A huge amount of data could possibly be sent at startup. The method to avoid this is called the slow start. When congestion occurs, TCP must slow its transmission rate of packets into the network, and then invoke slow start and/or congestion control to get things going again. In practice, they are implemented together.

Slow start operates by observing that the rate at which new packets should be transmitted on the network is the rate at which the acknowledgments are returned. Slow start adds another window to the sender’s TCP: the Congestion window. This is not advertised in the TCP header; it is assumed. When a new connection is established with a local or remote host, the congestion window is initialized to one segment. Segment sizes are variable depending on the computer or LAN type used, but the default, typically 536 (yes, 536 for it the segment size [TCP layer] that we are working with) or 512, could be used. Each time an ACK is received, the Congestion window is increased by one segment. The sender can transmit up to the minimum of the Congestion window and the advertised window. The distinction here is that the congestion window is flow control imposed by the sender, while the Advertised window is flow control imposed by the receiver.

Slow Start and Congestion Avoidance

  Before this, TCP would start to transmit as much data as was allowed in the advertised window.
  A new window was added called the congestion window.
  It is not negotiated, it is assumed. It starts out with one segment
  Segment size is variable, but usually set to 512 or 536 bytes
  Multiply this by the millions of hosts that are conversing on the Internet and you can see that immediate congestion follows.
  Slow start initializes a congestion window of 1 segment.
  Each subsequent ACK increments this window expotentially (1, 2, 4, 8, etc.) eventually to the advertised window size
  As long as there are no time-outs or duplicate ACKs during the transmission between two stations, it stays at the advertised window size.

The sender starts by transmitting one segment and waiting for its ACK. When that ACK is received, the Congestion window is incremented from 1 to 2, and 2 segments can be sent. When each of those 2 segments is acknowledged, the Congestion window is increased to 4. This rate continues to increase exponentially until the TCP Advertised window size is met. Once the Congestion window size equals the Advertised window size, segments are continually transferred between stations using the window size for congestion control on the workstations (just as if slow start had never been invoked).

However, upon congestion (as indicated by duplicate ACKs or time-outs), the algorithm kicks back in but starts up another algorithm as well (known as congestion control). When congestion occurs, a comparison is made between the congestion window size and the TCP advertised window size. Whichever is smaller, this number is then halved and saved in a variable known as the slow-start threshold. This value must be at least 2 segments unless the congestion was a time-out and then the congestion window is set to 1 (slow start). The TCP sender then can either start up slow start or congestion avoidance. Once ACKs are received, the congestion window is increased. Once the congestion window matches the value saved in the slow-start threshold, the slow-start algorithm stops and the congestion avoidance algorithm starts. This algorithm allows for more controlled (linear, not exponential like the slow-start algorithm) growth in transmission in that it multiples the segment size by 2, divides this value by the congestion window size, and then continually increases the rate based on this algorithm each time an ACK is received. This allows for growth on the TCP connection but at a more controlled rate

The effects of these algorithms were dramatic on the Internet. All versions of TCP/IP software now include these algorithms and their effects are not only based on remote connections. These algorithms are placed into action between two stations on a local subnet as well.

Slow Start and Congestion Avoidance (continued)

  Upon congestion (duplicate ACKs or time-out), the algorithm kicks back in.
  A comparison is made between the congestion window size and the advertised window size
  Whichever is smaller, is halved and saved as the slow-start threshold
  The value must be at least 2 segments unless the congestion was a time-out, and then the congestion window is set to 1 (slow start)
  The TCP sender can start up in slow start or congestion avoidance
  If the congestion value matches (or is greater than) the value of slow-start threshold, the congestion avoidance algorithm starts; otherwise, slow start is brought up.
  Upon receipt of ACKs, the congestion window is increased.
  Allows for a more linear growth in transmission rate.


Previous Table of Contents Next