TCP (four) - Flow Control

I: Overview Summary

TCP as a reliable transport layer protocol, its essence is a series of sliding windows, and other means to control traffic congestion avoidance. Data transmission rate can be adjusted according to the processing speed of the server and network, of course the entire process is transparent to the developer terms. This article from the sliding window, TCP congestion control two aspects Detailed traffic control operation done. This series of articles are read summary of them are based on the Nuggets brochure, interested friends can buy, absolute value for money

Here Insert Picture Description

Two: the receive window

Limited ability to process data server, the received data can not unlimited. There is a word property in the course of the three-way handshake is used exclusively mark the receive window size, three-way handshake to tell each other the receive window is only so big, 传输未确认的数据can only be so much more than just lucky I'll operations

See screenshot below is an example of three-way handshake FIG SYN packet, which can be seen on the red frame portion represents the size of the receive window. Red value box has three parts, specifically the following meanings:

  • Window size: Receive window size, not only the size of 16 bytes represents the window value, scaling introduced
  • Calculated window: Receive window size scaled calculated
  • Window scale:scaling ratio
Calculated window = Window size * Window scale
复制代码

As for why I'm here Wireshark packet capture right out of the displayed value, this also need to study. Should be able to debug, but the current value after the shot has been calculated display are indeed good

Here Insert Picture Description

Three: sliding window

With restrictions after receiving window of natural data transmission will not exceed this value, then the sliding window concept is what happens then? If the cursor sliding on the same composition as shown below:

Here Insert Picture Description
Sliding window consists of four parts of each byte of data has a unique coding sequence, evolved over time, and may transmit a portion of unacknowledged data packets encoded portion is moved to the right, as a sliding window

  1. 绿色: ACK has been sent successfully and acknowledged data
  2. 黄色: Wait ACK acknowledgment of successful transmission of data (occupied sliding window size)
  3. 紫色: Number of bytes in the remaining size of the sliding window can be sent (available sliding window size)
  4. 灰色: Encoding subsequent data

Receive window size is the maximum sliding window, sliding window size of available data transmission process is dynamic. But there is so little, just a sliding window design takes into account the processing capacity of the processing side, but did not take into account the problem of road smooth the way! ! ! If the server can handle 100M data, but the data transmission 99M are stuck in traffic, is not this road blockages yet? Back flow control will continue to explain another design Congestion Avoidance

Four: Slow Start

The implication is that the slow start probe crazy, probably procedure shown below: The transport layer data packets will first cut to the size of the transmission data segment 10 after the N data segments meet transmission requirements, will be transmitted after the normal ACK segment size 20 data, continue normal ACK will continue to double. Each transmission can be understood as a network transmission state detector detects the normal communication to the transport network will double the number of their transmission, the call restriction拥塞窗口

Here Insert Picture Description

Five: slow start threshold

Unlimited exponential growth slow start level? Think about the height of a piece of paper folded exponential explosion of Mount Everest is very scary operation. So in order to avoid unlimited exponential growth slow start, congestion window there is a limit 慢启动阈值, when the congestion window size reaches the slow start threshold of exponential growth will be revised to linear growth strategy: RTT is the meaning of a response to the request the complete process, which may include multiple data packet transmission and acknowledgment of

  • Slow start : slow start congestion window is smaller than the threshold value, exponential growth, doubling after every RTT
  • Congestion Avoidance : congestion window is greater than the slow start threshold, linear growth, after each RTT plus 1

Guess you like

Origin juejin.im/post/5e001439518825127e6fa0a6