Implementation of tcp ack in Linux-Summary and fairness

Source: Internet
Author: User

TCP is a reliable connection protocol, but don't count on the implementation of its theory. It is a practice. Nothing is a theory behind any practice, but a lot of theory, TCP is a combination of single stop, GBN (back n) and Sr (select re-transmission). Single stop is the most primitive theory, but the bandwidth utilization is too low, the later GBN implements pipeline-based data transmission and validation. The foundation of reliable connection lies in the confirmation-ack, while the GBN Ack is completely based on the receiver, the receiver simply sends only the serial number of the last message in order, and the sender receives all the packets that will be re-transmitted after the serial number, there are not many things to consider, but it may lead to a large number of unnecessary re-transmission actions. Therefore, the SR is mentioned as long as the receiving end receives a message and confirms it, the sender deletes the confirmed group from the retransmission linked list. If the confirmed group is on the far left of the window, the sender moves forward the sending window, which solves a series of problems in GBN, however, the new problem is that the implementation may be more complicated, and the handling of ack by both sending and receiving sides is very complicated.
The TCP implementation of Linux is essentially based on GBN, but the built-in SR Algorithm Is described in rfc2018, and is added as a TCP option, that is, the skeleton of TCP implementation or GBN, however, if you want to use the SR feature, it must be supported by the TCP Header option. Linux implements this, and will send ACK, receive ACK, and process Sr, the retransmission and other actions are completely separated, and the Ack is completely sent in GBN mode. If sack is required, set the option to receive and process ack in GBN mode, however, we need to check whether redundant ack has accumulated a certain amount. The Ack is handled by tcp_ack. Although it is based on, it does not have to worry about the large number of retransmission problems of GBN, because the retransmission action is completely different from that of tcp_ack, it will process retransmission Based on the sack-related information, rather than the GBN principle.
It is exactly ack that ensures the connection reliability. At the same time, Ack also controls TCP congestion and traffic control, so that TCP can realize the fairness of bandwidth (increase, multiply, and decrease ), however, fairness is only for the internal TCP. If a large number of crazy UDP videos are transmitted to the backbone network, because UDP does not have congestion control, it will occupy a large amount of resources and never go back, TCP has been congested due to packet loss or delay, so TCP has slowed down sending, so it gives UDP greater bandwidth, although this appeasement is not intentional, however, this problem needs to be solved urgently. Currently, the Protocol itself cannot find a perfect solution, but it can only be achieved through traffic control of routers or using iptables to configure related policies on Linux.
Therefore, TCP is a mixture of many theories, while TCP implemented by Linux is a mixture of many implementation suggestions.

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.