TCP/IP details-congestion control & slow start fast recovery congestion avoidance

Source: Internet
Author: User

Congestion control of TCP

1. Congestion: the need for resources exceeds the available resources. If many resources in the network are not available at the same time, the performance of the network is obviously bad, and the throughput of the whole network decreases with the increase of load.

Congestion control: prevents excessive data from being injected into the network, which can prevent routers or links in the network from overloading. congestion control has to do with a premise: The network can withstand the existing network load. Congestion control is a global process that involves all hosts, routers, and all the factors that are associated with reducing network transmission performance.

Flow control: Pointing to point traffic control, is the end to the correct problem. The flow control is to suppress the sending side to send the data rate, so that the receiving end time to receive.

Congestion control cost: the need to obtain information about the distribution of traffic within the network. Before congestion control is implemented, it is also necessary to exchange information and various commands between nodes in order to select the control strategy and implementation control. This creates additional overhead. Congestion control also needs to allocate some resources to individual users, so that network resources can not be better shared.

2. Several congestion control methods

Slow start (Slow-start), congestion avoidance (congestion avoidance), fast retransmit, and fast recovery (fast recovery).

2.1 Slow start and congestion avoidance

The sender maintains a state variable of the congested window CWnd (congestion windows). The size of the congestion window depends on the degree of congestion of the network and is dynamically changing. The sender makes its own sending window equal to congestion.

The principle of the sender to control the congestion window is that, as long as the network is not congested, the congestion window increases some more so that more packets can be sent out. But as long as the network becomes congested, congestion windows are reduced to reduce the number of packets injected into the network.

Slow start algorithm: When the host begins to send data, if the large amount of data bytes are injected into the network immediately, then it is possible to cause network congestion, because the network load is not clear now. Therefore, a better method is to first detect, that is, from small to large gradually increase the sending window, that is, from small to large gradually increase the congestion window value. Typically, the congestion window CWnd is set to the value of the MSS of the maximum packet segment when the message segment is just beginning to be sent. And after each receipt of a new message segment confirmation, the congestion window to increase the value of up to one MSS. Using this method to gradually increase the sender's congestion window CWnd, can make the packet injection to the network more reasonable rate.

Every passing round, the congestion window is doubled. The time spent in a transfer round is actually a roundtrip time rtt. However, the "transmission round" is more emphasis: the congestion window CWnd allowed to send the message segments are sent continuously, and received the last byte sent to confirm.

In addition, the slow start of "slow" does not mean that the growth rate of CWnd is slow, but rather when TCP begins to send a message segment is set cwnd=1, so that the sender at the beginning only send a message segment (to test the network congestion), and then gradually increase the CWnd.

In order to prevent the congested window CWnd from growing too large to cause network congestion, you also need to set a slow-start threshold ssthresh state variable (how to set Ssthresh). The use of the slow start threshold Ssthresh is as follows:

When CWnd < Ssthresh, use the slow-start algorithm described above.

When CWnd > Ssthresh, stop using the slow start algorithm and use the congestion avoidance algorithm instead.

When CWnd = Ssthresh, you can either use the slow-start algorithm or use congestion control to avoid the algorithm.

Congestion avoidance algorithm: Let the congestion window CWnd grow slowly, that is, each time a round trip through the RTT to the sender of the congestion window CWnd plus 1, instead of doubling. In this way, the congestion window CWnd grows slowly by linear law, and the congestion window grows much slower than the slow-start algorithm.

The slow start threshold Ssthresh is set to half of the value of the sender window when congestion occurs (but not less than 2), as long as the sender determines that the network is congested (based on the absence of acknowledgement), either in the slow start or in the congestion avoidance phase. Then the congestion window CWnd is reset to 1 and the slow start algorithm is executed. The purpose of this is to quickly reduce the number of packets sent to the network by the host, so that the congested routers have enough time to complete the backlog of packets in the queue.

For example, the above-mentioned congestion control process is illustrated with specific numerical values. The size of the sending window is now as large as the congested window.

<1>. When the TCP connection is initialized, the congestion window CWnd is set to 1. As mentioned earlier, for ease of understanding, the window units in the figure do not use bytes and the number of message segments. The initial value of the slow start threshold is set to 16 message segments, which is CWnd = 16.

<2>. When a slow-start algorithm is executed, the initial value of the congestion window CWnd is 1. Each time the sender receives a confirmation ACK for the new segment, it puts the congestion window value another 1 and then starts the next round of transmission (the horizontal axis of the graph is the transmission turn). Therefore, the congestion window CWnd increases exponentially with the transmission rounds. When the congestion window CWnd grows to a slow threshold value of ssthresh (i.e. when cwnd=16), the congestion control algorithm is implemented instead, and the congestion window grows by the linear law.

<3>. Assuming that the value of the congestion window grows to 24 o'clock, the network times out (which is likely to be congestion on the network). The updated Ssthresh value becomes 12 (that is, half the value of the congested window becomes 24 when the time-out occurs), the Congestion window is reset to 1, and the slow-start algorithm is executed. When the cwnd=ssthresh=12 is implemented instead of congestion avoidance algorithm, the congestion window grows linearly, increasing the size of one MSS per round trip time.

It is emphasized that "congestion avoidance" does not mean that congestion can be avoided altogether. It is impossible to use the above measures to completely avoid network congestion. "Congestion avoidance" is to control congestion in the congestion avoidance phase to increase by linear law, making the network less prone to congestion.

2.2 Fast retransmission and fast recovery

2.2 Fast retransmission and fast recovery

If the time-out timer set by the sender has arrived but has not yet received confirmation, it is likely that the network is congested, causing the segment to be discarded somewhere in the network. At this point, TCP immediately reduces the congestion window CWnd to 1, and executes the slow start algorithm, while the slow start threshold value ssthresh halved. This is a situation where fast retransmission is not used.

The fast retransmission algorithm first requires the receiving party to issue a duplicate acknowledgment every time a sequence of messages is received (in order for the sender to know earlier that the message segment did not reach the other) and not wait for the sender to confirm the data.

After receiving the M1 and M2, the receivers were given confirmation. Now assume that the receiver did not receive M3 but then received the M4. Obviously, the receiver cannot confirm the M4, because M4 is the received out-of-sequence message segment. According to the principle of reliable transmission, the receiver can do nothing, or at the appropriate time to send a confirmation of the M2. However, according to the provisions of the fast retransmission algorithm, the receiver should send a duplicate confirmation of the M2 in time, so that the sender can know earlier that the message segment M3 did not reach the receiving party. The sender then sends M5 and M6. Once the receiving party receives these two messages, it also has to issue a duplicate confirmation of the M2. In this way, the sender received a total of four acknowledgment of the M2 of the receiver, of which the first three were repeated confirmations. The fast retransmission algorithm also stipulates that the sender should immediately re-transmit the message segment M3 that has not been received, without having to wait for the retransmission timer of M3 set to expire, as long as it receives three duplicate confirmations in a row. Since the sender is re-transmitting the unacknowledged segment as early as possible, using fast retransmission can increase the overall network throughput by about 20%.

There are also fast recovery algorithms used with fast retransmission, which have the following two main points:

<1>. When the sender receives three duplicate confirmations consecutively, the "multiplication reduction" algorithm is executed to halve the slow-start threshold ssthresh. This is to prevent congestion on the network. Note: The slow start algorithm is not executed next.

<2>. Since the sender now thinks that the network is likely to have no congestion, the difference from slow start is that the slow start algorithm is now not executed (that is, the congestion window CWnd is not now set to 1), but instead sets the CWnd value to the value of the slow start threshold ssthresh halved, and then begins to perform the Congestion avoidance algorithm ("addition increases "), causing the congestion window to slowly increase linearly.

The fast retransmission and fast recovery are given, and the "TCP Reno version" is indicated.

Difference: The new TCP Reno version uses the fast recovery algorithm rather than the slow start algorithm after fast retransmission.

Also some fast retransmission implementation is to start with the Congestion window CWnd value increased a bit, that is, equal to Ssthresh + 3 X MSS. The reason for this is that since the sender receives three duplicate confirmations, it indicates that three groups have left the network. These three groupings no longer consume the resources of the network but remain in the recipient's cache. It can be seen that the network does not accumulate groupings but reduces the three groupings. Therefore, the congestion window can be expanded appropriately.

When using the fast recovery algorithm, the slow start algorithm is only used when the TCP connection is established and when the network time-out occurs.

The performance of TCP is obviously improved by using such congestion control method.

The receiver sets the receive window Rwnd according to its own receiving ability, and writes the window value to the Window field in the TCP header and transmits it to the sender. Therefore, the receive window is also called the notification window. Therefore, from the receiver's point of view of the sender's traffic control, the sender's sending window must not exceed the receiving window Rwnd given by the other party.

Upper value of Sender window = Min [Rwnd, CWnd]

When Rwnd < CWnd, it is the receiver's ability to limit the maximum value of the sender window.

When CWnd < Rwnd, the network congestion limit is the maximum value of the sender window.


Source: http://blog.csdn.net/yusiguyuan/article/details/22847787

TCP/IP details-congestion control & slow start fast recovery congestion avoidance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.