4.3.22 · D2Computer Networks

Visual walkthrough — TCP congestion control — slow start, congestion avoidance, fast retransmit, CUBIC

2,404 words11 min readBack to topic

Step 1 — Draw the two axes and the one dot we already know

WHAT. Before any formula, draw a blank graph. The horizontal axis is time in seconds, and we start the clock () at the instant a packet was lost. The vertical axis is the congestion window — how many segments the sender is allowed to have in flight (measured in MSS, the maximum segment size chunk).

WHY these axes and not "per RTT"? This is the whole point of CUBIC. Reno counts growth per round trip, so a flow with a short RTT grows faster and steals bandwidth from a slow-RTT flow. CUBIC instead grows as a function of wall-clock seconds since loss — the clock ticks the same for everyone, which is why CUBIC is RTT-fair. So the x-axis being real time is a deliberate design choice, not a coincidence.

PICTURE. One dot lives on this graph already: the height the window had just before the loss. Call that height (read "W-max"). It is the ceiling that caused the crash, so it is worth remembering. We assume — there was a real window to lose.

Figure — TCP congestion control — slow start, congestion avoidance, fast retransmit, CUBIC

Step 2 — The loss drops us DOWN, not to zero

WHAT. A CUBIC loss does not reset the window to 1 (that harsh reset is the timeout rule from the parent note). Instead it multiplies the window by a shrink factor. We name the shrink amount ("beta"), with the default . The window immediately after the loss is:

WHY multiply instead of subtract? This is the MD — Multiplicative Decrease — half of AIMD. Cutting by a fraction means big senders back off by a big absolute amount and small senders by a small amount, which is what makes competing flows converge to a fair share. With we keep of the old window. We assume a real shrink, : would mean no back-off at all (Step 7 handles that corner).

PICTURE. At our new dot sits at height , well below the old ceiling. The gap between "where we landed" and "the old ceiling" is exactly — remember this gap, Step 5 needs it.

Figure — TCP congestion control — slow start, congestion avoidance, fast retransmit, CUBIC

Step 3 — What shape should climb back? (Why a cube, not a line)

WHAT. We must choose a curve that carries the window from the low dot back up toward the old ceiling. We reject a straight line and reject a parabola, and choose a cubic — a function shaped like .

WHY a cube specifically? A cube has a magic property: it is flat in the middle and steep on both ends. That gives us three behaviours in one stroke:

  • Fast far below the ceiling — refill an empty fast-fat pipe quickly.
  • Gentle right near the ceiling — tiptoe around the height that just broke, don't overshoot.
  • Fast again above the ceiling — if the old ceiling turned out safe, accelerate to hunt for new bandwidth.

A straight line (Reno) gives none of this — it climbs at one boring constant rate. A parabola only bends one way. Only the odd, cube-shaped curve is flat in the centre and steep on both sides.

PICTURE. Compare three candidate climbs from the low dot: line, parabola, cube. Watch how only the cube flattens near the ceiling and then re-accelerates.

Figure — TCP congestion control — slow start, congestion avoidance, fast retransmit, CUBIC

Step 4 — Slide the flat part of the cube onto the old ceiling

WHAT. A plain cube is flat at . But we want it flat at the moment the window reaches the old ceiling , which happens some seconds later. So we shift the curve sideways by an unknown amount we call , and shift it up to sit at height :

Term by term, right where each symbol lives:

  • — seconds since the loss (our x-axis).
  • horizontal shift: this whole bracket is zero when , which is exactly where we want the flat spot.
  • — the cube, giving the flat-middle-steep-ends shape from Step 3.
  • — a steepness knob (default ); bigger climbs more aggressively. We assume (Step 7 shows why is forbidden).
  • vertical shift: lifts the flat spot up to the old ceiling height.

WHY the bracket and not ? Subtracting pushes the flat inflection point to the right (into the future), which is what we want — we haven't reached the ceiling yet at . Adding would put it in the past.

PICTURE. The dashed plain cube slides right by and up by until its flat centre kisses the ceiling line.

Figure — TCP congestion control — slow start, congestion avoidance, fast retransmit, CUBIC

Step 5 — Pin the curve to the low dot to SOLVE for

WHAT. We have one unknown left: . We fix it by demanding the curve start at the low dot from Step 2. That is: at the window must equal . Substitute :

Now simplify, watching each move:

Cancel the minus signs. To divide by we need — dividing by zero is undefined, so this whole step silently assumes the we declared in Step 4:

Term by term:

  • — the vertical gap we fell in Step 2 (from ceiling down to the low dot). With and this gap is positive, so is a real positive number.
  • — divide by the steepness knob; a steeper curve needs less time to climb the gap.
  • — the cube root undoes the cube; it answers "which , when cubed, gives that gap-over-steepness?"

WHY a cube root here? Because the curve is a cube. To invert "" you must take the cube root — the exact opposite operation. Any other root would leave the equation unbalanced.

PICTURE. The curve now passes through both anchor dots: the low dot at and the ceiling at . It is fully pinned down — no freedom left.

Figure — TCP congestion control — slow start, congestion avoidance, fast retransmit, CUBIC

Step 6 — Read the three regions off the finished curve

WHAT. With solved, split the timeline into three named regions by comparing to . To name the bends precisely, look at the second derivative , whose sign tells us which way the curve bulges:

when shape name behaviour
negative concave down (bulges upward, slope decreasing) concave probing climb fast, then ease off near the ceiling
zero inflection instant (slope momentarily zero) ceiling crossing gently touch the old ceiling
positive concave up / convex (slope increasing) max probing accelerate to explore for new bandwidth

Note the row is a single instant, not an extended flat region: has zero slope only at that one point, so the curve merely pauses its climb for an instant and immediately resumes — there is no plateau of finite width.

WHY does the shape flip at ? is the cube's inflection point — the spot where changes sign, so the curve stops bending one way and starts bending the other. Left of it is concave-down and cautious; right of it is concave-up and bold. One curve, two personalities, glued at the single instant .

PICTURE. The single curve painted in three colours: cautious blue below , the yellow crossing instant at , bold pink above .

Figure — TCP congestion control — slow start, congestion avoidance, fast retransmit, CUBIC

Step 7 — The degenerate cases (never leave a scenario unshown)

WHAT. Check the corners where things could break:

  • (no shrink). Then , the low dot equals the ceiling, and the curve is flat at already — nothing to climb. This is a network that lost a packet but the window didn't drop; CUBIC just idles at the ceiling. Degenerate but well-defined.
  • (forbidden knob). The formula divides by , so makes blow up to infinity — the curve would never bend at all. That is why is fixed to a strictly positive constant ( by default): is simply not a legal setting.
  • A second loss before reaching the ceiling (). We never got to explore; the new becomes wherever we were, we shrink again by , and re-solve for a fresh, smaller . The curve simply restarts from a lower dot.
  • Tiny — the TCP-friendly region (with the actual threshold). On a small pipe the cube climbs slower than plain Reno would. To avoid ever being worse than Reno, CUBIC also tracks an estimate of the Reno window, and at every moment uses . The switch-over threshold is exactly where these two cross: while (which happens for small ) CUBIC follows the Reno line; once the cube overtakes it, CUBIC follows the cube. (For the opposite extreme — huge pipes — see BBR Congestion Control, which drops loss-based probing entirely.)

WHY bother? A control law you deploy on billions of machines must have a defined answer for , for , for back-to-back losses, and for small links — otherwise real traffic hits an undefined corner and stalls.

PICTURE. Two mini-panels: the flat case, and an early second loss restarting the curve from a lower dot.

Figure — TCP congestion control — slow start, congestion avoidance, fast retransmit, CUBIC

The one-picture summary

WHAT. One board that compresses all seven steps: the two anchor dots, the shift by and , the three coloured regions, and the boxed final formula with its cube-root .

Figure — TCP congestion control — slow start, congestion avoidance, fast retransmit, CUBIC
Recall Feynman retelling — the whole walkthrough in plain words

A packet got lost. We remember exactly how tall our window was at that moment and call it the ceiling, . We don't panic-reset to nothing — we just shrink by , so we land at of the ceiling. Now we need a way to climb back. A straight line is too dumb, a bowl-shape only bends one way, but a cube is flat in the middle and steep at both ends — perfect: race up while we're low, tiptoe as we near the old ceiling, then race again if the ceiling turns out safe. We slide that cube sideways so its flat instant sits right on the ceiling; the slide amount is . To find we just demand the curve start at our landing dot, plug in , and (as long as the steepness isn't zero) a cube-root pops out: . The clock is in real seconds, not round trips, which is the secret to being fair to fast and slow connections alike.

Recall Quick self-check

Why is the growth curve a cube and not a line? ::: A cube is flat in the middle and steep at both ends — cautious near the old ceiling, fast when far below or above it. A line grows at one constant rate with no such caution. What does the bracket do? ::: It shifts the flat inflection point to (into the future), the moment the window reaches the old ceiling. Where does the cube root in come from? ::: From inverting (legal only because ); the cube root undoes the cube. At , what height is the curve? ::: — the point we landed on right after the multiplicative decrease. Is a flat plateau? ::: No — it is a single instant where the slope is momentarily zero (the inflection point); the curve pauses for one instant and resumes, with no finite-width flat region. What are the units of ? ::: , so that comes out in segments.


Related: Flow Control vs Congestion Control · Queueing and Router Buffers · TCP Reliable Data Transfer