Body
Many people will think that a good TCP congestion control algorithm will make connection acceleration, this view is wrong, on the contrary, all the congestion control algorithm is for TCP to pull back at greedy time, most of the time, congestion control is to reduce the speed of data transmission.
I will be in this article for the recent chat with friends in the industry record, summed up the few words.
The ultimate goal of TCP congestion control is not to speed up data transmission, which is very selfish and superficial! Its end goal is to increase the bandwidth utilization indefinitely under the premise of fair occupancy bandwidth!
If you are only interested in a separate TCP connection itself, then you may never be able to design a better algorithm, but if you do not start from a separate connection, it seems more ethereal, after all, you can get and control only one connection!
Considering the design of a process scheduler, starting with 2.6.23, it is generally assumed that the Linux scheduler ushered in a new phase, the CFS phase, in contrast, the O (1) Scheduler is just like a transition, and the previous O (n) scheduler is slightly more elementary. I was also concerned about the new scheduler for a while, just as I was focusing on TCP BBR this time ... So, let's take a look at where the CFS is, so that it can occupy the top spot of the Linux default scheduler.
First we ask, does CFS make the process run faster? Non-also, a bit of experience know, for the pursuit of high-throughput environment, CFS instead let the process run slower. Relatively superficial cognitive perspective, it is generally easy to "good" and "fast" closely linked together, but in fact, standing at a higher level, you see will not be a separate process, but a whole machine inside all the process! Where is CFS in the end?
From its name it can be seen that the advantage is "totally fair"! It treats the symptoms of almost all unfair scheduling in the O (1) scheduler, such as the preemption and hunger problems between IO consumption and interaction processes, such as scheduling granularity problems, and so on, when a virtual clock is introduced, fairness is measured in a very precise measure, and these problems are finally resolved. From the beginning to the end, no independent process "is speeding up the speed of operation"!
Finally, the CFS allows all processes to run at full capacity as much as possible, with equal CPU time, which increases CPU utilization. The whole process has no burrs and is very smooth.
----------------------------------------------------
, let's look at the benefits of smoothing instead of burrs, and just looking straight in the eye is so handsome! The Krauts are on fire again! Audi finally built the spherical tires ... "
----------------------------------------------------
Now back to TCP itself, BBR and the same year's CFS, aroused the attention of everyone. I think I've drawn up the idea of "how to design a good TCP congestion control algorithm".
Looking down over the global Internet, you see all the TCP connections, not just the one or the other ones built on your machine. This is the pattern, and your prejudice will naturally be eliminated. Shanghai naturally wants to compete with Beijing, but Beijing does not see it, no matter where it is, it is Beijing's, isn't it? How to make all TCP connections fair share all the Internet bandwidth is the root of the TCP congestion control algorithm! Note the two key points, one of which is to share equitably, and second, as much bandwidth as possible.
This problem is a world problem, no process scheduler so simple!
The process Scheduler works on a single CPU, or, in simple words, for a single machine. This machine is in your hand, you, the designer of the scheduler can see clearly what is happening in the current machine, all the unfair symptoms, all the waste phenomenon can give designers a panoramic view, you can be forced to take a process of resources to another process, you can also kill too greedy process ... For TCP, there is no one can stand in the global Internet to look down on the man, TCP congestion control is completely distributed, each designer can only see the part of their own machine connection!
However, TCP congestion control is so difficult is not what the so-called distributed caused, in fact, distributed is not difficult, the difficulty is that TCP congestion control is always misunderstood, so in the design of the algorithm, a little attention will be the opposite, it is to avoid congestion, is actually plugging.
Why is it misunderstood? In fact, Caesar has long said that people always see what they want to see. This sentence has another meaning, people are happy to see their own local as all. People can see the process of a whole machine at a glance, so it's easy to design a good process scheduler, so CFS appears. But we do not see all the TCP connection, we see only their own TCP connection, so we can only speculate, I am good, you. As for whether the algorithm is plugging, it may not be out of malice at all, but it is the short-sighted and the pattern is not high caused.
A correct, and good TCP congestion control algorithm should take into account all the connections, if TCP is not fast enough, it should be all TCP speed up, which reflects the increase in bandwidth utilization, if TCP is fast enough, then any connection can not be faster, this is a manifestation of fairness. It is very simple to change the word, if you feel that driving down the road slow, then on the high-speed, if you are already on the highway, please do not change road overtaking.
How simple the truth, but can still see the road lane overtaking, I may express a problem, is all the drivers are playing lane overtaking, if let these people to design TCP congestion control algorithm, will be good where to go? Unfortunately, the world's TCP unilateral acceleration play the most fire of the people, and this batch of Chinese good driver is the same group of people, no matter what resources, the only goal, except Rob, or Rob.
In fact, I am not a moral preacher, say what people for me, I for everyone's algorithm is a good algorithm, said as if I did it ...
I was scolded by two Masters only to know the wrong change, in fact, I have also been possessed ...
Some time ago, I modified a congestion algorithm, presented to a master evaluation, let's call the Master 1 bar, worthy of "show off" is my this algorithm is very fast, even faster than BBR, but was a bad loss of a meal, my algorithm "competition is definitely the first", but "irresponsible" ... This is an algorithm for destroying character. Later, I tried to get two or more streams running the same algorithm to transfer data together, sure enough ... Some streams will instantly squeeze the remaining stream bandwidth to 0! Even foe are not divided, is simply a rogue algorithm Ah! This algorithm is also burned after reading, completely unusable.
...
If that doesn't count, then another master 2 makes me feel like I don't know shit.
This master is abroad, and I sometimes poor, and can read Chinese but do not write Chinese, I am in contrast, I can read English but it is difficult to write, so only mail communication. Topic or congestion control, I just asked "How to make TCP data send faster" problem, the answer is very simple, ignoring congestion control and compensatory retransmission, then I wrote a "Ignore congestion control congestion control algorithm", and provocative as a response. Then the message appeared fxxk vocabulary, and suck ... Said I did not understand the basic principles, and urged me to resign my work home to study and think carefully. I was almost crying.
...........
The guidance of the Master 2 before the Master 1, but the Master 1 gave me the direction and method of concrete how to do, I except from the heartfelt gratitude, can do is to write some "attack TCP congestion Control algorithm" article to put people for me, I for everyone's Christian philosophy to pass to more people. Due to the respect of two masters and various friends, I will not post the relevant code, the original message and the chat record, digest the idea of processing, from my direct origin here.
BBR at the end of this article, I'll talk a little bit about what algorithm is the correct algorithm through the BBR algorithm.
BBR, like the CFS of the year, I've already said that. But BBR is still at a relatively rudimentary stage, at first, I think the problem is:
1. Convergence is too slow, that is, will not be slowed down the window immediately, but to be completed in a few RTT;
2. It is too late to detect upward. Question 1 is the remedy for this;
3. Preemption under the big BDP cache is debatable;
4.BBR relies on the SDN infrastructure ...
...
As you can see, this initial understanding reflects how deep I am in my personal skills. However, after the master's guidance, I found that the biggest problem with the original BBR is that it introduces a new congestion control framework can easily be misused, see http://blog.csdn.net/dog250/article/details/54754784
If a few of the third-stream than I am poor people using the new framework to write algorithms, then the internet crashes around the corner, fortunately, even if the crash, but also only the domestic internet collapse, in this field, the foreign moon is round, after all, they are more educated than us, understand the game theory, even from the point of view of selfish people, It's not something you can do that is not selfish. It is noteworthy that the knowledge does not mean that there is a culture, I have always felt that the domestic university is actually a technical school, especially Huazhong University of Science and Technology, almost directed to Huawei, bat and other giants to cultivate senior craftsmen.
Back to BBR. For the new frame brought by BBR, the most serious is, before someone to spell speed and re-transmission, there will be PRR down the window, this is not controlled by the algorithm module, now good, directly write a callback, completely around the window, we all go to add block to the TCP design of the principle level, The RFC also seems to have put fairness in the highest position. Because if the fairness is not the basic principle, then the whole ring will not be closed, the bandwidth resources are exhausted, at this time the blind AI non-MD process will urge everyone to move forward, and finally who can not get through, so that the Internet will be completely unusable! For this reason, all the individuals and vendors who engage in "TCP side-by-side acceleration" are doing bad things, and their starting point is wrong. Of course, this kind of manufacturer's starting point is often not the TCP level, but the business level, it is understandable, after all, is not an area, I do not have the right to ask too much, TCP for them is just a tool, really to which day the Internet crashes, they will still use trucks to transport the way to carry out data transmission, then, The jammed truck on the freeway, like TCP, is just a tool.
----------------------
What is the right thing to do?
First to introduce a gentleman algorithm, that is Ledbat algorithm, you can see Http://www.rfc-base.org/txt/rfc-6817.txt, its wiki is Https://zh.wikipedia.org/wiki/LEDBAT
Its ideas in the "acceleration" of those who look, in fact, a bit funny, it is to fill the cubic and bloat buffer when the gap, once there are other traffic caused the queue, Ledbat immediately teng place concessions. This algorithm is supposed to be "accelerator" the first time to abandon the algorithm, but it in iOS and Win10 in the way, Ledbat mainly used for software updates, such things can be silently in the background, the priority is relatively low, so the invention of a backstage silent gentleman-style ledbat algorithm, Actually in the increase in bandwidth utilization Fair bet ah, but this algorithm will not compete with other traffic bandwidth, the slightest should not be high-priority traffic fairness, is not very handsome algorithm? Ledbat in the expression is, you go to the front block to go, I do not you important, I walk slowly on the line ...
BBR is not a gentleman-style algorithm, it is to participate in fair competition, I do not take the initiative to bully people, but be bullied, I will not timid, so bbr in Ledbat increased the process of more probe, at the same time, and Ledbat concessions, BBR will be changed to a gentle easing drain less.
None of this has just happened recently, and before that, the Vegas algorithm represents a correct approach, which ultimately does not have the upper hand because the Vegas deployment has a premise that the same time all deployed to Vegas, but this is not possible, as long as there is reno or cubic in, Vegas "The right way" would be a disadvantage. The reality is that, the bad currency drive good currency, cubic is clearly the wrong algorithm, but because it can use a very low but very simple method to quickly converge to the available bandwidth, so it has been recognized by the algorithm, all people are silently endure the bufferbloat, The additional queuing delay caused by this problem greatly reduces the interaction experience of the interactive TCP connection, while severely impacting real-time protocols such as NTP.
Cubic is bound to block the road, after buffer is blocked, the data of the interactive application will be queued, the time delay increases, the interactivity naturally decline.
I have been intrigued by the question of why the reno,cubic of the stream after a slow start is called congestion avoidance, and on the contrary, this blind way to the black window will inevitably lead to congestion, that is, congestion is unavoidable. Does this process tarnish the word "congestion avoidance", or is it just a definition? The following article gives an answer, now the time is Saturday 7:30 A.M., should sleep for a while.
Write in the final preface: "Last night into the city, return tears full fly" that is silly, he is not sericulture is, why envy others wear silk.
Today is the weekend, and can rise in the middle of the night, this writing began at 5:30, completed in early 72, before, I spent one hours to read the "rupee doughnut" 25 pages, and then one hours ago, I saw some of the road planning things, mainly on the disturbing computer ... Now, originally I want to sleep, but can't sleep, want to go to unstoppable, only a pity side of the mountain are too short ... Since the return of Ganzi, the mountains in Shenzhen have become small mounds ... Actually, to buy food, cooking is the solution, what to cook? Haha, Chongqing brings the old hot pot!
----I hope you can read this article.
TCP congestion control algorithms that are easily misunderstood