4.3.22 · HinglishComputer Networks

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

2,266 words10 min readRead in English

4.3.22 · Coding › Computer Networks


Woh do windows jo ek sender ko limit karti hain

HUM KYA control karte hain: cwnd. KYUN: rwnd receiver ki RAM ko protect karta hai; cwnd network ki queues ko — yeh do alag bottlenecks hain.

Hum cwnd ko MSS (Maximum Segment Size) ki units mein measure karte hain clarity ke liye. Throughput , toh bada cwnd = faster — jab tak loss na ho.


1. Slow Start (SS) — jaldi se ballpark dhundo

HOW yeh badhta hai (first principles se derivation): Hum chahte hain ki har ACK receive hone par cwnd 1 MSS badhe.

  • Maano cwnd = segments. Ek RTT mein hum segments bhejte hain → ACKs receive karte hain.
  • Har ACK 1 add karta hai → ek RTT ke baad, cwnd .

Toh per-RTT: . 1 se shuru karke RTTs ke baad:


2. Congestion Avoidance (CA) — limit ke paas tiptoe karo

HOW (derivation): Hum chahte hain RTT mein +1 segment, lekin ACKs poore RTT mein aate rehte hain. cwnd = segments ke saath, ACKs per RTT aate hain, aur hum chahte hain ki unka total effect +1 MSS ho: ACKs pe sum karne par: . ✓ Exactly +1 per RTT.

Toh per-RTT:

Yeh AIMD ka AI hai (Additive Increase, Multiplicative Decrease).


3. Loss ke baad react karna — do flavours

WHY halve karo (AIMD mein MD)? Aadha karna ek strong, multiplicative back-off hai jo jaldi congestion relieve karta hai aur, additive increase ke saath combine hokar, ek fair, stable sawtooth deta hai jo converge karta hai (AIMD chart se proven — fairness line).


4. Fast Retransmit — clock ka wait mat karo

Isse ek poora RTO (jo hundreds of ms ho sakta hai) bachta hai, aur pipe full rehti hai.

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

5. CUBIC — modern default (Linux, kernel 2.6.19 se)

ki derivation (WHY woh cube root): Loss ke baad, cwnd tak drop hota hai... ruko — actually CUBIC factor se drop karta hai, toh new window hoti hai. Hum chahte hain ki cubic curve par new window se guzre aur par tak pahunche (uska inflection plateau). set karo:


Worked Examples


Common Mistakes


Recall Feynman: 12-saal ke bachche ko explain karo

Socho ki tum ek patli pipe mein paani daal rahe ho lekin pipe dikhi nahi. Tum ek trickle se shuru karte ho, phir har second flow ko double karte ho yeh dhundhne ke liye ki kitna laggta hai. Jis moment paani wapas splash kare (ek packet lost ho gaya), tum samajh jaate ho ki tumne bahut hard push kiya, toh tum flow ko aadha kaar do aur phir sirf thodi thodi si zyada har second mein add karo, perfect amount ki taraf sneaking up karte hue. Agar splash ek tiny dribble tha (3 duplicate "mujhe abhi bhi ek missing hai!" notes), toh sirf halve karo. Agar pipe completely silent ho gayi (timeout), toh trickle par wapas slam karo. CUBIC ek smarter version hai: yeh yaad rakhta hai woh flow rate jisne last splash cause kiya, race back up karta hai just below tak, usse test karne ke liye pause karta hai, phir carefully upar push karta hai dekhne ke liye ki kahin pipe badi toh nahi hui.


Flashcards

cwnd kya limit karta hai aur kaun maintain karta hai?
Woh amount of unACKed data jo network handle kar sakta hai; sender ke paas locally maintain hota hai (wire pe kabhi nahi bheja jaata).
Slow start mein cwnd per ACK aur per RTT kaise change hota hai?
Per ACK +1 MSS ⇒ per RTT doubles (exponential): cwnd(n)=2^n.
Congestion avoidance mein per-ACK increment kya hai?
cwnd += MSS²/cwnd, jo +1 MSS per RTT (linear, additive increase) sum hota hai.
AIMD ka kya matlab hai aur yeh stable/fair kyun hai?
Additive Increase, Multiplicative Decrease; sawtooth fair, efficient sharing mein converge karta hai.
Reno ka TIMEOUT par reaction?
ssthresh = cwnd/2; cwnd = 1 MSS; slow start restart karo.
Reno ka 3 DUPLICATE ACKs par reaction?
ssthresh = cwnd/2; cwnd ≈ ssthresh (halve); congestion avoidance mein raho (Fast Recovery).
Exactly TEEN duplicate ACKs kyun fast retransmit trigger karte hain?
1–2 dup ACKs packet reordering ho sakti hai; 3 strong evidence hai ki segment truly lost ho gaya, toh RTO ka wait kiye bina retransmit karo.
CUBIC ka window function likho.
W(t) = C·(t−K)³ + W_max, t = last loss ke baad ka time.
CUBIC mein K derive karo.
W(0)=(1−β)W_max require karo ⇒ −C·K³ = −β·W_max ⇒ K = ∛(β·W_max / C).
CUBIC ki concave-then-convex shape clever kyun hai?
Concave: fast grow karo phir purane W_max ke paas slow karo (danger zone ke paas caution); K ke baad convex: new bandwidth probe karne ke liye accelerate karo.
CUBIC Reno se better RTT fairness kyun deta hai?
Iski growth RTT par nahi balki loss ke baad real elapsed time par depend karti hai, toh different RTTs wale flows similarly grow karte hain.
Cwnd ke terms mein throughput?
≈ cwnd / RTT.

Connections

  • TCP Reliable Data Transfer — cumulative ACKs aur retransmission timers (RTO) jin par yeh build karta hai.
  • Flow Control vs Congestion Control — rwnd vs cwnd, do distinct bottlenecks.
  • AIMD Fairness — fairness line par convergence ka geometric proof.
  • Queueing and Router Buffers — jahan dropped packets actually hote hain (Bufferbloat).
  • BBR Congestion Control — loss-based CUBIC ka model-based alternative.
  • Bandwidth Delay Product — kyun long fat networks ne CUBIC ko motivate kiya.

Concept Map

solved by

controls

combines via min

combines via min

measured in

phase 1

grows

reaches ssthresh then

grows

is the AI of

timeout RTO

3 dup ACKs

triggers MD

Network congestion collapse

TCP congestion control

cwnd sender side

rwnd receiver window

Bytes in flight

MSS units

Slow Start

Exponential doubling per RTT

Congestion Avoidance

Linear plus 1 MSS per RTT

AIMD

Packet loss signal

Fast Retransmit