What Is TCP Slow Start

TCP Slow Start

What is TCP Slow Start?

TCP Slow Start is part of the congestion control algorithms put in place by TCP to help control the amount of data flowing through to a network. This helps regulate the case where too much data is sent to a network and the network is incapable of processing that amount of data, thus resulting in network congestion. TCP Slow Start is not the only algorithm put in place to help prevent network congestion, there are four intertwined congestion control mechanisms in total.

These mechanisms are defined in RFC 5681 as slow start, congestion avoidance, fast retransmit, and fast recovery.

Collectively, these four algorithms together help mitigate network congestion, however in this article we will focus primarily on Slow Start.

How TCP Slow Start Works

When transmission of data from sender to receiver begins in a network, there may be unknown conditions as to what the network can handle. Slow Start helps to mitigate the pitfalls of this unknown by implementing the following functionality.

  1. A sender begins transmissions to a receiver by slowly probing the network with a packet that contains its initial congestion window (cwnd).
  2. The client receives the packet and replies with its maximum buffer size, also known as the receiver’s advertised window (rwnd).
  3. If the sender receives an acknowledgement (ACK) from the client, it then doubles the amount of packets to send to the client.
  4. Step 3 is repeated until the sender no longer receives ACK from the receiver which means either congestion is detected, or the client’s window limit has been reached.

Plotted on a graph, the relationship between cwnd and time would look similar to the following in the case of TCP Slow Start:tcp slow start graph

Example

According to RFC 5681, the initial value of cwnd is defined relative to the sender’s maximum segment size (SMSS) for a connection. IW represents the initial cwnd in the following guideline.

 If SMSS > 2190 bytes:
       IW = 2 * SMSS bytes and MUST NOT be more than 2 segments
 If (SMSS > 1095 bytes) and (SMSS <= 2190 bytes):
       IW = 3 * SMSS bytes and MUST NOT be more than 3 segments
 if SMSS <= 1095 bytes:
       IW = 4 * SMSS bytes and MUST NOT be more than 4 segments

According to RFC 5681, a MSS of 1460 is common across the internet. Following the above guidelines, that means that the initial cwnd would be 3 * 1460 = 4380 which allows us to send 3 full segments once the connection is establish. Once the sender receives acknowledgement from the receiver of those segments, the sender can then increase the cwnd by 1460 for every acknowledgement. This means the new congestion window would now  be (4360 +1460 + 1460 + 1460) = 8740 allowing the sender to now send 6 segments.

This process will continue until the receiver doesn’t acknowledge segments or the receiver’s window has been reached. At this point Slow Start has served its purpose and allows data to be transmitted at maximum capacity without congesting the network.

Issues with TCP Slow Start

There do exist certain scenarios where TCP Slow Start does not perform optimally, for instance:

  • Old web browsers open multiple short-lived connections which tcp slow start does not function well with. Therefore the short-lived connections remain in slow start mode thus increasing load times.
  • Since TCP slow start associates unacknowledged segments as network congestion, it can perform badly in situations where the reception is sub-par.

Although there do exist a couple of pitfalls in using TCP slow start, the majority of use cases are beneficial for preventing network congestion and transmitting data at appropriate speeds.

The Benefits Of TCP Slow Start

TCP Slow Start is a valuable mechanism in determining how much data a particular network can handle. Although some may believe that the bigger the “pipe”, aka the more bandwidth you have, the faster and more efficient your network will be, this is not necessarily true. The thing is, HTTP makes connections in short bursts which inhibits us to use the full potential of the pipe. In fact, according to some research done at Google, a 10mbps connection is only utilizing about 16% of it’s capacity. This means that instead of investing in more bandwidth, reducing the amount of round trips from sender to receiver may be more beneficial – which is a big advantage in using HTTP/2.

Without TCP Slow Start, many networks would be congested as the sender would not have proper buffer size information to send to the receiver. However, with TCP Slow Start, it enables data transfer to be optimized resulting in a faster experience for web users.