TCP Congestion Control Introduction & Notes

TCP congestion control

Main reference: The seventh edition of Xie Xiren's Computer Network.

General principles of congestion control

The computer network includes various resources, such as link bandwidth, buffer size in the switch / router, processor performance, and so on. If within a certain period of time, the networkThe demand for a resource speculates on the available part that the resource can provide, The network performance becomes worse, it is calledcongestion. which is:
Correct Capital source of need begging > can use Capital source \ sumrequest for resources> available resources
is the network congestion caused by many factors, simply add resources can not completely solve the problem.

The difference between congestion control and flow control

The two are closely related, but there are differences.
Congestion control is to prevent excessive data from entering the network, so that the routers / links in the network will not be overloaded. The premise of congestion control is that the network can bear the load, which is aGlobal process.
Flow control refers to the control of point-to-point traffic and is an end-to-end problem.

Understanding of congestion control

Insert picture description here

As shown in the figure above, the abscissa is the load provided , representingNumber of packets input to the network per unit time, Which is the number of resources requested, also known as input load / network load; the ordinate is throughput , representingNumber of packets output from the network between units

  • Ideal congestion control : Before the throughput is saturated, the network throughput is equal to the network load, in a linear relationship. When the load exceeds the limit, due to the limitation of network resources, the throughput reaches saturation and maintains the maximum throughput.
  • No congestion control : As the load increases, the rate of increase in throughput gradually decreases. That is, before the network reaches saturation, some input packets have been discarded, and when the throughput is significantly less than the load, it enters a state of light congestion. Continue to increase the load, may enter congestion or even deadlock.
  • Actual congestion control : After the throughput is saturated, it still cannot reach the maximum throughput and can only approach the maximum throughput.

TCP congestion control method

TCP congestion control methods include: slow-start, congestion avoidance, fast retransmit, and fast recovery.
Assumptions :

  • The data is transmitted in one direction, and the other party only transmits the confirmation message.
  • The receiver has enough buffer space, so the size of the sending window is determined by the degree of network congestion.

Slow start && congestion avoidance

Based on window congestion control, the sender maintains a state variable congestion window cwnd. Its size depends on the degree of network congestion and changes dynamically. The sender's transmission window size is equal to the congestion window cwnd.
Congestion window control principles: There is no congestion in the network. Cwnd can be increased to send more packets to improve network utilization. If the network is congested, cwnd should be reduced to reduce the number of packets injected into the network and alleviate possible congestion on the network. The idea of
slow start : At the beginning, the load of the network is not clear, so the cwnd is increased from small to large . The slow start of the old version stipulates that the initial cwnd is 1 or 2 the maximum value of the SMSS of the sender. The new version stipulates that the initial cwnd does not exceed the value of 2 to 4 SMSS.
In slow start, each time a confirmation of a new message is received, the congestion window can be increased by up to one SMSS value, namely: D c w n d = m i n ( N , S M S S ) \Delta cwnd=min(N,SMSS) , where N is the number of bytes that were originally unacknowledged but are now confirmed by the confirmation message field received.
The congestion avoidancealgorithm is to slowly increase the congestion window cwnd, that is, each RTT, cwnd ++, rather than double as slow start, at this stage, cwnd grows slowly according to a linear law, making the network less prone to congestion.

Actually the slow start cwnd is inThe initial stage is exponential growth(When N <SMSS), in
order to avoid the network congestion caused by the excessive growth of cwnd, a state variable is also needed: slow start threshold ssthresh,

  • When cwnd <ssthresh, use the slow start algorithm;
  • When cwnd> ssthresh, use congestion avoidance algorithm;
  • When cwnd = ssthresh, use slow start and congestion avoidance.

For ssthresh, when a timeout occurs (that is, congestion occurs), change ssthresh to half the value of cwnd when the timeout occurs. s s t h r e s h = c w n d 2 ssthresh=\frac{cwnd}{2}
Insert picture description here

Fast retransmission && fast recovery

Sometimes, the loss of individual messages will cause a timeout, but no congestion occurs. If the sender restarts slowly and starts slowly, it will reduce the transmission efficiency. The use of fast retransmission can let the sender know as soon as possible the loss of individual messages. .
First, fast retransmission requires the receiver not to wait for confirmation, but to send confirmation immediately, even if the out-of-sequence message is received, it must immediately send out the received segmentDouble confirmation, And once the sender receives three repeated confirmations, it immediately retransmits the next message of the confirmed message (for example, the following figure, received 3 M 2 M_2 ACK means M 3 M_3 Lost, retransmit M 3 M_3 ), So that there will be no timeout, and the sender will not mistakenly believe that network congestion has occurred.
Insert picture description here
As point 4 in the above figure, the sender receives a 3-ACK and does not start a slow start, but executesQuick recovery,make s s t h r e s h = c w n d 2 = 8 ssthresh=\frac{cwnd}{2}=8 At the same time, set cwnd = ssthresh = 8 to execute the congestion avoidance algorithm.
Insert picture description here
At the beginning of this article, I ideally set the receiver's cache to be infinite, but in fact the receiver will set an rwnd according to its own ability, also known as the notification window. The sender's sending window must not exceed the receiver's rwnd. Therefore:,
but in fact the receiver will set an rwnd according to his own ability, also known as the notification window, the sender's sending window must not exceed the receiver's rwnd. and so:
M A X = M i n [ r w n d , c w n d ] Sender window_ {MAX} = Min [rwnd, cwnd]

Published 7 original articles · liked 0 · visits 117

Guess you like

Origin blog.csdn.net/qq_43534805/article/details/105545712