TCP congestion control algorithm-from Bic to cubic

Source: Internet
Author: User
Tags ack

This article is intended to help you understand the dots behind the TCP cubic congestion control algorithm and why its equations are that way. All along, many people feel that the cubic algorithm is very complex, involving complex heavenly book-like "3 times Curve" ... However, Cubic is not as complex as everyone thinks, and it is complicated because it does not understand its history and background.

This article is to introduce the history and background of cubic ...

BIC algorithm
The BIC algorithm searches for the maximum possible value of a window, based on the following facts:
1. If a packet loss occurs, the size of the window is W1, then to keep the line full load without losing packets, the actual window maximum value should be below W1;
2. If a drop packet has been detected and the window multiplier has been reduced to W2, the actual window value should be above W2.

Thus, after the TCP fast recovery phase has passed, a binary search is performed within the W2~W1 interval to find the actual maximum value of the window. The definition of W1 is Wmax, and W2 is defined as wmin.
The above is said "Tao", next we look at the "technique", that is how to drive the whole binary search process, very simple! With ACK driver:
each time an ACK is received, the window is set to the midpoint of Wmax and Wmin and continues until it is close to Wmax.
It is visible that the BIC behavior is ack-driven, and when the ACK arrives is associated with RTT. Here, let's leave a question first.
After learning "Tao" and "technique", let's look at "potential". Tao is only a principle, treat everyone is the same, and the technique is the way to achieve this principle, everyone has a different, but ultimately decide who can dominate the world is the trend, that is to say, after understanding the Tao, and get the surgery, the next step into the scramble stage. The BIC algorithm has been infinitely close to the Wmax without packet loss, which means that the bandwidth has free resources, the maximum bandwidth is more than Wmax, but a value greater than Wmax! The question is, how to find it! Before talking about how to find it, let's talk about how to know that you have found it, and the answer is to drop the packet.
Beyond Wmax, how to find new Wmax?
Also very simple! Now that the Wmax has not been lost, the new Wmax has not yet been reached, and the BIC has taken a very simple and straightforward approach: to go back in accordance with the path of approximation Wmax, that is, to adopt a symmetric scheme.
Above the whole way, law, potential three summed up into the following diagram:




Two RTT different connections, their time to search through the BIC algorithm Wmax is different, and then it enters the max-probe phase is also different, so the idle bandwidth will be the short RTT of the connection ruthless possession:




Of course, the BIC algorithm is far more than that simple, the above diagram is only theoretical, when it comes to implementation it is necessary to consider the behavior characteristics of the TCP runtime, such as the problem shown:




This leads to the ugliness and complexity of BIC implementations, with many If-else appearing, which is uncomfortable in the senses.
----------------------------------------------------------------
We've seen the half-view of the BIC, and we've got two problems with it:
the question of fairness
TCP's use of bandwidth is not the prince's process of sweeping the liuhe, more like the modern European equilibrium. So, the algorithm to rob the bandwidth is a silly algorithm.
a problem with a less sensual appearance
The mathematical pursuit is that since the principle is a formula, in the implementation must also be a formula, can not add more realistic constraints.
----------------------------------------------------------------
The process of solving these problems led to the birth of cubic!
It's worth noting that Bic and cubic are particularly interesting in naming., BIC is the acronym for binary increase congestion, and cubic is not a Bic plus a "cu-" prefix (what is the-CU prefix?? )... Cubic is not what abbreviation, it is "cubic" adjective full name, and cubic in mathematics is also "3 times Square" meaning, therefore, as the name implies, Cubic uses the mathematical function namely cubic curve way, but not through the ACK arrives after the processing behavior (B) inary (I) Ncrease (C) ongestion to probe the window. On the naming, this is worth noting.
notes:Since there will be a simple mathematical formula, because it is inconvenient to insert the Greek alphabet in the text, so all the Greek letters in the mathematical formula, I have written in the text of their English transliteration, for example, I will use beta to denote the corresponding pronunciation of the Greek alphabet that is similar to the letter of the uppercase B.


Cubic algorithm
Let's take a look at how the cubic is done. The window detection process is not related to RTT.
To achieve a fair window detection behavior in time, it is necessary to make all connected similar BIC-like detection curves consistent, that is, all TCP connections with the same detection curve! How do we do that? Very simple. Find a mathematically defined curve! There is no RTT in the curve equation argument of this curve.
We know that in a two-dimensional Cartesian coordinate system, there is only one argument for the curve, and we define it as an absolute time, which is only relevant to the absolute time difference from the beginning of the curve to the receipt of the ACK. The question now is how to define the curve itself so that it looks more like the BIC's probing curve. First of all, it should be a few times floss (we certainly already know it is 3 times curve, but here is a process rather than a conclusion!). )?
We observed the BIC curve, and we found that it was a process where the growth rate began to be large, slowly becoming smaller, approaching 0, and then slowly getting bigger ...
Considering the rate of change, the derivative is not thought of. Now the problem is transformed to:
whose derivative is slowly becoming smaller, becoming 0 and then slowly getting bigger?
Before we can find the final curve, we need to find the curve of the derivative itself and then the ascending order. The problem is becoming more and more easy. People who have studied high school math basically know that the two curves meet the requirements of this derivative curve, and we take this two-time curve as an example:




Then draw the graph and find it perfectly interprets the slope trend of the BIC window probing curve:




The original curve corresponding to this derivative curve is a 3-time curve:




This is just an example, our goal is to determine the cubic curve shape, yes, the final cubic curve is like this, is it similar to the BIC window detection curve?
After determining the shape of the curve, we will finally determine the parameters of the curve, and the equation of the final curve should be:




By completing this step of determining the undetermined coefficients, we can thoroughly understand all that is behind Cubic's seemingly complex equation.
The first and most important step in determining the undetermined coefficients is to determine the form of the curve equation. This step is important! It is even more important than the perception of the shape of the curve. If there is no determination of the form of the equation, only two points on the curve to be determined to determine the coefficients of the 3-curve equation, like the solution of the indefinite equation, become a skill alive. Conversely, once the form of the curve equation is determined, the process of finding the undetermined coefficients is very simple!
We know that the curve is symmetrical and consists of a convex and concave part (is this the cubic curve fitting the BIC curve, or the reverse?:-(), since the cubic curve is actually a bounded symmetric curve, when the final parameter is determined, the curve at the midpoint of the horizontal axis R is also determined, We observe the final curve and find that the midpoint of the horizontal axis is exactly at the vertical Wmax, and then the left boundary of the curve, and when the curve is at the initial moment, W begins to grow from the end of the fast recovery, that is, the position of the Ssthresh value:




This position is beta*wmax!.
What we need to do is to use the undetermined coefficients method to construct the equations, and then find out the coefficients and give their physical meanings.
But we're not really going to a,b,c,d the coefficients of the F (x) Two-term representation, but rather construct it in a more reasonable form.

Note that there are three points on the curve that are special, as shown in:




and notice that the curve itself is about the point symmetry of P (X=r,y=wmax), and we determine that the constant factor of the curve equation is Wmax. Therefore, we can simply write the curve equation in the following form:




The goal now is to ask for H (x).
Notice that the other two points constrain the curve, from the curve about the point P (R,wmax) symmetry, we can know:




And




which




By the above-mentioned three (1), (2), (3) and (0) know:




By (4), (5), we can construct a reasonable form of H (x):

According to the above (4) and (5), we get an expression of R:




# #不得不承认以上是一个很合理的解
Here, you may find this more and more complicated, but in fact, this derivation is very simple, and the derivation is over, and that's the final result of cubic! We change the coefficient a in the equation to C, then the final formula is:




Ok! It's over. Now let's take a look at the two parameters in this equation, beta and C, what they represent, or more visually, what they control separately.
For one time from the end of fast recovery to the congestion avoidance process of packet loss, we assume that the window size of the packet loss is Wmax, and assume that there is no other connection in the network, then the window detection curve is the same in each round of congestion detection, so we think Wmax is constant. Obviously, Beta determines the height of the entire symmetry range of the curve, while R controls the time to reach the drop window from the start window, and because R is inversely proportional to C, the greater the C, the shorter the maximum window is detected, and the longer the inverse. As a result, we can control the behavior of the cubic algorithm as long as we control the beta and C two parameters.
Do you know the details of the cubic curve now? Well, we've been wandering around in mathematical formulas, and now we're finally going back to TCP! Let's take a look at what the beta and a (that is, c) in the curve affect the TCP characteristics, as described in Cubic's paper:
Beta controls the TCP friendliness
C Control the convergence speed of TCP

Since the cubic curve is symmetric in the stable congestion avoidance phase (Steady state) and the Idle Resource detection phase (MAX probing), we understand the convergence speed as two aspects, on the one hand, it determines the time when TCP congestion window reaches the maximum window in a stable congestion avoidance phase, On the other hand, it determines the time required to detect a new maximum window at the exploratory stage of the idle resource. This symmetrical behavior, is it really reasonable??
Finally, I will cubic algorithm run and the general TCP congestion Control algorithm mapping, I found that it is not special, run the cubic algorithm TCP connection, will also be the operation phase mapping to one of three stages, respectively, the stable phase (Steady state), that is, the phase of no packet loss, The new idle resource detection phase (max probing), which detects the new largest window, and the phase of fair convergence, that is, the phase of reducing the amount of data sent (similar to the PRR window process), unlike BBR, Cubic's fair convergence phase is not controlled by its own algorithm (PRR), The BBR is controlled by itself (by default it runs 1 cycles, followed by 6 constant-stable cycles, and the BBR cycle is a servo cycle: 1 Max Probing-1 Drain-6 steady state-...). The overall operation of the cubic is as follows:




PostScript to this, I think this article should be finished. I personally believe that the greatest sense of accomplishment in this article is to explain clearly what the interior of Cubic's 3-time curve looks like and why it is like this. Many people do not know its true face, think how it can be so complex, in fact, Cubic is not complicated! It is derived from the BIC algorithm step-by-step. If you follow the normal derivation, those parameters can be self-determined, there is no mystery. What about the BIC algorithm? Simpler, a process that performs a two-point lookup drive after receiving an ACK packet.
After I analyzed the BBR algorithm, I once said that the BBR algorithm is very simple, so far, do you think Cubic is also very simple? Before you give a positive answer, I have to clarify some of their differences.
The BBR algorithm is the description of its behavior itself, while the cubic algorithm borrows a mathematically beautiful curve equation, which does not correlate with any TCP behavior, in other words, if there is a better choice, you can not use this curve. This is very different from the ECC algorithm (Elliptic curve encryption algorithm) background, ECC algorithm can not get rid of elliptic curve, it is in this curve group, ring, domain calculation defines the whole algorithm process. The difference between the two points is very important for optimizing the cubic.

Attached 1: Optimization and flexibility since the TCP congestion algorithm is borrowing a 3-time curve, then this curve is not necessary! Looking closely at the last picture in this article, like the BIC algorithm, the cubic algorithm is symmetrical in the stabilization and probing stages, but does it have to be this way?
If I knew that when the detection of Wmax is near congestion, the cubic curve is still silly to go up to detect until the packet lost, so it is appropriate? is obviously inappropriate. So we may need an asymmetric cubic curve! For example, a bit steeper in the stabilization phase, a little slower in the probing phase, which could eventually evolve to a similar effect of the BBR algorithm!
But do I really need another curve?? Perfectionists or mathematical neat people may particularly want to use an equation to describe this asymmetric curve, but if you just want to implement this idea in engineering, there is absolutely no need to look for a curve, directly using an asymmetric curve.
I don't go into this topic any more, I'll just show you the changes to the Linux cubic code. To modify the Bictcp_update:
The meaning of Curr_c = cube_rtt_scale;//Base_mdev is that the Mdev is just entering the congestion avoidance stability State, while Curr_mdev is the current mdevif (Ca->base_mdev && ca- >curr_mdev && T > Ca->dragon_k) {if    (Ca->curr_mdev > Ca->base_mdev)//If the RTT becomes more jittery, This indicates that the probability of packet loss is larger        curr_c >>= 1;  For just one example, the aim is to stretch the curve width    if (Ca->base_mdev < Ca->curr_mdev)        curr_c <<= 1;  Designed to compress the curve width}delta = (cube_rtt_scale * offs * offs * offs) >> (10+3*bictcp_hz);
Attachment 2: Summarizing and documenting why should the window be reduced to a very low value when losing a packet, instead of just subtracting 1 or 2? Please study the TCP fairness Convergence diagram I posted earlier.
The cubic curve is determined by the parameters.
The BIC curve is determined by the behavior.
The convergence of bic/cubic is triggered by events, and BBR is triggered by its own servo mechanism.

TCP congestion control algorithm-from Bic to cubic

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.