TCP/IP Note 3. Transport Layer (2) -- TCP traffic control and congestion control

Source: Internet
Author: User

TCP/IP Note 3. Transport Layer (2) -- TCP traffic control and congestion control can be said to be integrated. Traffic control is implemented through a sliding window. Congestion Avoidance mainly includes the following two content: (1) slow start, congestion avoidance (2) Fast retransmission, fast recovery 1. traffic control-Sliding Window TCP uses a variable-size Sliding Window for traffic control. The unit of the window size is byte. The sending window is agreed upon by both parties when the connection is established. However, in the communication process, the receiving end can dynamically adjust the upper limit of the sending window (which can be increased or decreased) of the other party based on its own resource conditions ). Why set a window? We can understand the window as a buffer (but some windows are not the same as the buffer ). If these "Windows" are not available, TCP must wait until the receiving end confirms before sending the next piece of data. In this case, the efficiency of TCP transmission is too low. The solution is to continue sending data while the sender is waiting for confirmation. Assume that the message sent to the X Data segment is the confirmation message from the receiver, this is acceptable if X is within the acceptable range. This is why the window (buffer zone) is introduced. 1.1 window (1) receiver window rwnd receiver buffer size. The receiving end places the window value in the window field of the TCP packet header and sends it to the sending end. (2) congestion window cwnd (congestion window) sending side buffer size (3) Sending window swnd sending window Upper Limit = Min [rwnd, cwnd] When rwnd <cwnd, it is the maximum sending window limit of the receiving end. When cwnd <rwnd, It is the maximum number of transmission windows restricted by network congestion. 1.2 The sender of the sliding window has sent 400 bytes of data, but only receives confirmation of the first 200 bytes of data, and the size of the window remains unchanged. It can also send 300 bytes. The sender receives confirmation from the sender of the first 400 bytes of data, but the sender of the notification must reduce the window to 400 bytes. Currently, the sender can send up to 400 bytes of data. 2. congestion Control 2.1 slow start and congestion prevention 2.1.1 slow start principle (1) when the host just starts to send a packet segment, you can set the congestion window cwnd to a maximum message segment MSS value. (2) After receiving a confirmation message segment, add the congestion window to a maximum of one MSS value. (3) gradually increasing the congestion window cwnd at the sending end using this method can make the packet injection rate to the network more reasonable. 2.1.2 example description note: the unit of the window in the figure is the packet segment (1) when the TCP connection is initialized: sending window: swnd = 1 slow start threshold: ssthresh = 16 (2) after receiving ACK1 (confirm M0, expect M1), the sender increases cwnd from 1 to 2, and then the sender can send M1 and M2 packets (exponential growth) (3) the receiving end sends back ACK2 and ACK3. Each time the sender receives a confirmation ACK for the new message segment, it adds 1 to the congestion window of the sender. Now, the cwnd of the sending end is increased from 2 to 4, and the M4 ~ can be sent ~ There are 4 CIDR blocks in M6. (Exponential growth) (4) When swnd> = ssthresh, swnd executes the congestion avoidance algorithm, and the swnd window grows linearly. (Addition increases) (5) when sending times out, swnd = 24: ssthresh = swnd/2 = 12; (multiplication decreases) swnd = 1 (6) repeats two steps. 2.2 fast retransmission and fast recovery 2.2.1 as long as the sender of the fast retransmission receives three duplicate ACK in a row, it can be determined that a group is lost, in this case, the lost packet segment should be re-transmitted immediately without having to wait for the timeout of the retransmission timer set for the packet segment 2.2.2 fast recovery (1) when the sending end receives three consecutive duplicate ACK packets, set the slow start threshold ssthresh. (2) The difference from the slow start is that swnd is not set to 1, but ssthresh + 3 * MSS. (3) If the number of duplicate ACK packets received is n (n> 3), set cwnd to ssthresh + n * MSS. (4) If the sending window value also allows the sending segment, continue sending the Segment Based on the congestion avoidance algorithm. (5) If an ACK is received to confirm the new packet segment, swnd will be reduced to ssthresh.

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.