preface

Generally, packet loss is caused by router cache overflow when the current network becomes congested. In practice, there are two main congestion control methods: end-to-end congestion control and network-assisted congestion control

End-to-end congestion control

  • End-to-end congestion control
    • The network layer does not provide display support for congestion control at the transport layer, and the end system must also infer congestion by observing network behavior (such as packet loss and delay)
    • Typically, a packet loss event is defined as either a timeout occurs or three redundant ACKS are received from the receiver
  • Network – assisted congestion control
    • The router provides display feedback to the sender about the state of congestion in the network
    • The router flags or updates a field in the packet that flows from the sender to the receiver to indicate congestion

TCP must use end-to-end congestion control rather than network-assisted congestion control because the IP layer does not provide displayed network congestion feedback to the end system

TCP takes the approach of having each sender limit the rate at which it can send traffic to the connection based on perceived network congestion control

TCP congestion control algorithm

The algorithm consists of three parts: slow start, congestion avoidance and fast recovery

The difference between slow start and congestion avoidance is the way in which the CWND length is increased in response to received acks, which is mandatory, and fast recovery is recommended but not required

Senders maintain a congestion window, called CWND, that limits the rate at which a TCP sender can send traffic to the network

After the TCP connection is established, the CWND of the congestion window is set to 1 MSS (MSS: maximum packet length), and a slow start threshold ssTHRESH = CWND /2 is required

  • When CWND < SSTHRESH, the slow start algorithm is used
  • When CWND > SSTHRESH, stop using the slow start algorithm and use the congestion avoidance algorithm instead
  • When CWND = SSTHRESH, either the slow start algorithm or the congestion avoidance algorithm can be used

1. Slow start

The value of CWND starts at 1 MSS and increases by 1 MSS each time the transmitted message segment is first acknowledged

As shown in the figure, there is one message segment at the beginning, and after receiving confirmation, another MSS is added to send two message segments of maximum length; after confirmation, another MSS is added to send four message segments of maximum length (i.e., 1, 2, 4, 8… Such growth, exponential growth)

So when does slow start end? There are three ways

  1. If there is a packet loss event (congestion!) indicated by a timeout , the TCP sender sets CWND to 1 and restarts the slow start
  2. If CWND is detected at or above SSTHRESH, end the slow start and move into congestion avoidance mode
  3. If three redundant ACKS are detected, fast retransmission is performed and a fast recovery state is entered

And that’s all for slow start

So what is congestion avoidance? Keep reading

2. Avoid congestion

We switched to congestion avoidance when CWND exceeded SSTHRESH, because it would have been reckless to continue with a slow-start exponential growth after CWND had reached or exceeded SSTHRESH, so we opted for a more conservative approach – each RTT would only increase the CWND value linearly

For example, if MSS=1460 bytes and CWND =14600 bytes, then sending 10 packet segments in an RTT increases the length of the congestion window by 1/10 * MSS for each ACK. After receiving all 10 ACK segments, the value of the congestion window increases by 1 MSSCopy the code

3. Fast recovery (used with fast retransmission)

After receiving three duplicate ACKS, the system knows that the next packet segment is lost. In this case, fast retransmission is performed, that is, the next packet is immediately retransmitted

However, in this case, individual packet segments are lost, not network congestion

At this time, perform a quick recovery, let ssTHRESH = CWND /2, CWND = SSTHRESH, directly into the congestion to avoid.

Difference between flow control and congestion control

  • Congestion control prevents too much data from being injected into the network and prevents overload of routers or links on the network. It is a global process

  • Flow control is the control of point-to-point traffic, which is an end-to-end problem. It is mainly to suppress the rate at which the sender sends data so that the receiver can receive it in time