In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Xiaobian to share with you what is the difference between flow control and congestion control in the computer network, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article. Let's learn about it!
Main differences: flow control solves the problem of rate mismatch between sender and receiver; congestion control solves the problem of avoiding network resources being exhausted. Flow control is achieved through sliding windows; congestion control is achieved through congestion windows.
The difference between flow Control and congestion Control
Flow control and congestion control of TCP seem to be two similar concepts, which are easy to be confused. But in fact, the goals they expect and the methods they use are completely different.
Flow control solves the problem of rate mismatch between sender and receiver. If the sender sends too fast, the receiver will not have time to receive and process. The mechanism adopted is the sliding window mechanism, which controls the number of packets sent but not Ack.
Congestion control is to avoid the depletion of network resources, through self-discipline to take evasive measures to avoid the depletion of limited network resources. When packet loss occurs, the rate of transmission is controlled to reduce the network load.
Flow control
Flow control is achieved by sliding the window. The sliding window is divided into the sender window and the receiver window.
The window has a size limit, which is the maximum number of bytes that the receiver uses to tell the sender that the receiver can receive it.
The size of the window is 16 bits in the TCP protocol header. However, in the optional TCP protocol, the window scale factor can also be defined, so the actual window size can exceed 64KB. The meaning of the window is actually the size of the receive buffer.
The sending window maintains the sequence number of the ACK sent by the sender and the maximum sequence number that has been sent, so that you can know how much more new data can be sent.
The receive window maintains the sequence number of the already ACK, as well as the sequence number of all received packets.
The window size is constant during a specific connection communication. The sliding window is a mechanism, the size of the sliding window represents the size of the data that can be sent at the sender and the size of the data that can be received at the receiver, and they are dynamic.
Congestion control
Congestion control is achieved through the congestion window. Congestion window refers to the maximum number of packets that the sender can send in a RTT.
Congestion control generally includes two stages: slow start and congestion avoidance.
The slow start phase is a process of exponential growth from 1 to a limited size.
The process of linear increase after exceeding the limited size in the congestion avoidance phase, and the process of changing the congestion window to 1 and halving the limited size after packet loss is found.
Extended data
Flow control is end-to-end control, for example, A sends data to B through the network, and A sends data too fast so that B can not receive it (B buffer window is too small or too slow to process). The principle is to change the size of the sliding window.
Congestion control is that the network congestion between An and B leads to slow transmission or packet loss, and there is no time for transmission. Prevent too much data from being injected into the network so that the routers or links in the network are not overloaded. Congestion control is a global process, involving all hosts, routers, and all factors related to reducing network performance.
Flow control mechanism:
Set host A to send data to host B. The window value determined by both sides is 400. Then let each message segment be 100 bytes long, the initial value of the sequence number is seq=1, the uppercase ACK indicates that the header is considered as ACK, and the lowercase ack indicates the value of the confirmation field.
Host B of the receiver carries out three times of flow control. The window is set to rwind=300 for the first time, and then reduced to rwind=100 and finally reduced to rwind=0, that is, the sender is not allowed to send any more data. This state that causes the sender to pause transmission will continue until host B reissues a new window value.
Suppose that shortly after B sends a zero-window message segment to A, B's receive cache has some storage space. So B sent a rwind=400 message segment to A, but the message segment was lost in transmission. A has been waiting for a non-zero window notification from B, while B has been waiting for data from A. It's deadlocked. To resolve this deadlock state, TCP has a persistence timer for each connection. As soon as the party of the TCP connection receives the zero window notification from the other party, it starts the persistence timer and sends a zero window probe message segment (carrying only 1 byte of data) if the duration timer setting time expires, and the other party gives the current window value when confirming the probe message segment.
Congestion control mechanism:
Slow start and congestion avoidance
The rate of sending message segment should be determined not only according to the receiving capacity of the receiver, but also from the overall consideration of not making the network congested, which is determined by the two state variables of the receiving window and the congestion window. The receiver window (Reciver Window), also known as the notification window (Advertised Window), is the latest window value promised by the receiver according to the current receiving cache size, and it is the flow control from the receiver. Congestion window cwnd (Congestion Window) is the window value set by the sender according to its own estimated degree of network congestion, and it is the flow control from the sender.
Slow start principle:
1) when the host starts to send data, if all the data bytes of the larger sending window are immediately injected into the network, it is possible to cause network congestion because the situation of the network is not clear.
2) A better way is to test it, that is, to gradually increase the congestion control window value of the sender from an early age.
3) usually when you start sending a message segment, you can first set the congestion window cwnd to the value of the MSS of the largest message segment. After each confirmation of the new message segment, increase the congestion window by at most one MSS. When the rwind is large enough, in order to prevent the network congestion caused by the growth of the congestion window cwind, another variable-slow start threshold ssthresh is needed.
The specific process of congestion control is as follows:
1) initialize the TCP connection and set the congestion window to 1
2) when the slow start algorithm is executed, cwind grows exponentially, knowing that cwind = = ssthress starts to implement congestion avoidance algorithm, and cwnd grows linearly.
3) when the network is congested, update the ssthresh value to half of the pre-congestion value, reset the cwnd to 1, and follow step (2).
Fast retransmission and fast recovery
A TCP connection is sometimes idle for a long time due to waiting for the timeout of the retransmission timer. Slow start and congestion avoidance can not solve these problems, so a congestion control method of fast retransmission and fast recovery is proposed.
The fast retransmission algorithm does not cancel the retransmission mechanism, but retransmits the lost packet segment earlier in some cases (if the sender receives three duplicate acknowledgement ACK, it is determined that the packet is lost and the lost packet segment is retransmitted immediately without having to wait for the retransmission timer to time out). The slow start algorithm is used only when TCP is established.
The fast recovery algorithm has two main points:
1) when the sender receives three repeated acknowledgements in succession, the "multiplication reduction" algorithm is implemented to halve the slow start threshold in order to prevent network congestion.
2) because the sender now thinks that there is probably no congestion in the network, it does not execute the slow start algorithm now, but sets the cwnd value to the value after the slow start threshold is halved, and then starts to execute the congestion avoidance algorithm to increase the congestion window linearly.
These are all the contents of this article entitled "what's the difference between flow control and congestion control in computer networks". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.