Congestion control and flow control

Source: Internet
Author: User

First, TCP traffic control
1, using sliding window to achieve flow control
If the sender sends the data too fast, the receiver may be too late to receive it, which can result in loss of data. The so-called flow control is to let the sender of the transmission rate is not too fast, to let the receiving party in time to receive.
The sliding window mechanism can be used to control the sender's traffic conveniently on the TCP connection.
Set A to B to send the data. When the connection is established, B tells a: "My receive window is Rwnd = 400" (Here the Rwnd means receiver window). Therefore, the sender's send window cannot exceed the value of the receiving window given by the receiver. Note: TCP's Window units are bytes, not message segments

Each segment is set to 100 bytes long, and the initial value of the data segment ordinal is set to 1. An uppercase ACK indicates the acknowledgment bit ACK in the header, and a lowercase ACK indicates the value ACK of the Acknowledgment field.


As you can see, B has three flow control. The first time the window was reduced to Rwnd = 300, the second was reduced to rwnd=100, and finally reduced to 0, that is, the sender is not allowed to send the data. This state that causes the sender to pause sending continues until Host B re-emits a new window value. b The three message segments sent to A are set to ack=1, and only the confirmation number field is meaningful at ack=1.
TCP has a continuous timer for each connection. The persistent timer is started whenever a TCP connection receives a 0-window notification from the other party. If the duration of the timer is set to expire, a 0 window is sent to explore the segment (with 1 bytes of data), then the party receiving the message segment will reset the continuous timer.

2. Congestion control

TCP uses slow start and congestion avoidance methods to control the sending
The idea of a slow start is to test it in a small-to-large increase in the Send window
Specific: Pre-set a slow-start threshold, Ssthresh (for congestion control)
First set up a congestion window cwnd=1, send the first message, received confirmation after the CWnd set to 2, in the sending, received a reply, and then add 2 CWnd, that is, after receiving a reply to the CWnd increase by one times, this is the slow start algorithm
Congestion avoidance algorithm is used when Cwnd>ssthresh stops the above slow-start algorithm
The congestion avoidance algorithm adds 1 to the CWnd after each reply, until congestion occurs.
The Ssthresh is set to half of the original value (this is the multiplication is reduced) and the CWnd is set to 1 at slow start or congestion avoidance, repeating the process as long as the congestion occurs.

Congestion control and flow control

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.