[Transport layer] transport control protocol TCP Overview 2

Source: Internet
Author: User

[Transport layer] Transport Control Protocol (TCP) Overview 1. TCP traffic control 1) implement traffic control using a sliding window: so that the speed of the sender is not too fast, the unit of the TCP Window received by the receiver is byte, not the packet segment. 2) MSS: Maximum Segment Size the Maximum transmission Size is the Maximum data Segment that can be transmitted by a TCP packet each time. In order to achieve optimal Transmission Performance, TCP usually needs to negotiate the MSS value of both parties when establishing a connection, this value is often replaced by the MTU value when the TCP protocol is implemented (the packet header size of the IP address must be reduced to 20 Bytes and the packet header of the TCP data segment must be 20 Bytes) therefore, generally, the MSS value 1460 communication parties will determine the maximum MSS value for this connection based on the MSS value provided by both parties. Note: The maximum message segment length (MSS) is easy to misunderstand. MSS is the maximum length of data fields in TCP packets. Adding the TCP header to the data field is equal to the entire TCP packet segment. Therefore, MSS is not the maximum length of TCP packets, but is: MSS = TCP packet segment length-TCP Header length 3) confused window syndrome when the sending application process produces data very slowly, or the receiving receiver application process processes the Received Buffer data very slowly, or both, the message segment transmitted between application processes is very small, in particular, the payload is small. In extreme cases, the payload may only have 1 byte, while the transmission overhead may be 40 bytes (20 bytes of IP header + 20 bytes of TCP Header). This is called the confusion window syndrome, for example: the buffer space at the TCP receiving end is full. The interactive application can only read one byte from the receiving space at a time, send a confirmation message to the sending end, and set the window to 1 byte. The 41-byte transmission overhead of the sending end is 40 bytes (20-byte IP header + 20-byte TCP Header ). Solution: Let the receiver wait for a while, so that there is enough free space to accommodate a maximum segment or half of the free space. Sender: the sender must accumulate a certain data segment before sending. 2. TCP congestion control is a global process that prevents excessive data from being injected into the network, so that the network router or link is not overloaded. Traffic control is an end-to-end process. It controls the sender. Do not send too fast, so that the receiver can handle it in time. Open-loop control: when designing a network, consider the factors related to congestion in advance. Closed-loop control: based on the concept of feedback loop Congestion Control Method: 1) Slow Start and congestion to avoid the sender's Control Window Principle: as long as the network is not congested, the window will increase, to send more groups. Once congestion occurs, the window is reduced to reduce the number of branches injected into the network. Slow Start and congestion prevention algorithms must be used by the TCP sending end to control the amount of data being transferred to the network. To implement these algorithms, you must add two parameters to the TCP connection status. The congestion window (cwnd) is a sender's limit on the maximum data volume that can be transferred to the network before the sender receives the ACK. the receiving end's notification window (rwnd) is the receiving end limit for the amount of unfinished data. Min (Cwnd, rwnd) determines another state parameter for data transmission, the slow start threshold value (ssthresh ), it is used to determine whether to use slow start or congestion avoidance algorithms to control data transmission cwnd <ssthresh slow start algorithm cwnd> ssthresh congestion avoidance algorithm cwnd and ssthresh can use both slow start and congestion avoid slow start: the cwnd size index increases, that is, the congestion window doubles every transmission round. Congestion avoidance: cwnd increases at a speed of 1 full-size data segment per round-trip (RTT). That is, the congestion window increases by 1 for every transmission round. (Cwnd + = SMSS * SMSS/cwnd) when the algorithm is executed to avoid congestion, the network is congested (the confirmation is not received on time), and the START threshold is ssthresh) set to half of the window size when congestion occurs, and then re-set cwnd to 1 to execute the slow start algorithm. 2) Fast retransmission/fast recovery fast retransmission: After receiving an out-of-order packet segment, the Receiver immediately sends a duplicate confirmation (so that the sender knows that a packet segment has not reached the receiving end as soon as possible ), instead of waiting for the receiver to send data with confirmation. If M1 and M2 are received and M4 is received, M3 is lost. If the following message segments are not M3, M2 is sent for confirmation. If M5, when the sender receives three repeated confirmations, it should immediately re-send the message to M3. fast recovery: When three repeated confirmations are received, the sender executes the multiplication reduction algorithm and halved the slow start threshold ssthresh. Do not run the slow start algorithm. In this case, the algorithm is executed to avoid congestion because the network is not congested. If the network is congested, three packets will not be connected. Iii. Random Early Detection RED 1) Overview vro Group discard policy has a great impact on TCP congestion control. If a route is discarded, congestion occurs. A route discards an IP group, and an IP group may contain several TCP connections. As a result, many TCP connections start slowly at the same time. Global synchronization 2) the maximum threshold value of the discard policy is THmax. If the group has excess THmax values, it must be discarded. In the case of two limits, individual groups should be discarded with probability p, so that congestion control can only be performed on individual TCP connections, so as to avoid global congestion control. Minimum threshold THmin. It is appropriate that THmax = 2 * THmin is not discarded for groups smaller than THmin.

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.