network protocols: design and analysis
DESCRIPTION
Network Protocols: Design and Analysis. Polly Huang EE NTU http://cc.ee.ntu.edu.tw/~phuang [email protected]. TCP Papers. [Jacobson88a] [Fall96a]. Key ideas. [Jacboson88a]: implementation of transport layer TCP theory behind TCP congestion control: packet conservation - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/1.jpg)
Network Protocols: Design and Analysis
Polly Huang
EE NTU
http://cc.ee.ntu.edu.tw/~phuang
![Page 2: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/2.jpg)
TCP Papers
[Jacobson88a]
[Fall96a]
![Page 3: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/3.jpg)
Polly Huang, NTU EE 3
Key ideas
• [Jacboson88a]:– implementation of transport layer TCP– theory behind TCP congestion control: packet conserva
tion– congestion control alg and how it relates to other TCP a
lgorithms
• [Fall96a]: – benefits of SACK (selective acknowledgements)– compares several loss recovery algorithms
![Page 4: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/4.jpg)
Polly Huang, NTU EE 4
Agenda
• connection setup and teardown• flow control• congestion control theory• congestion control practice (in TCP)
– slow start– congestion avoidance
• loss recovery• putting it together• security• performance
![Page 5: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/5.jpg)
Polly Huang, NTU EE 5
TCP Congestion Control
• two mechanisms:– slow start– congestion avoidance
• interacts very closely with loss repair:– good retransmit timeout (RTO) estimation– fast retransmit and recovery– why?
• packet loss is the signal for congestion• packet loss recovery can cause redundant work during times of conge
stion• but need to recover from loss reasonably quickly or goodput drops to
zero
![Page 6: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/6.jpg)
Polly Huang, NTU EE 6
TCP Congestion Principals
• underlying principle: packet conservation– at equilibrium, inject packet into network only
when one is removed– basis for stability of physical systems
• components:– how to get there: slow start– how to stay there: congestion avoidance
![Page 7: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/7.jpg)
Polly Huang, NTU EE 7
TCP Congestion Control Mechanisms
• new congestion window cwnd– what the network can handle– vs. flow control window (wnd): what the other
end can handle
• sender limits tx– min (wnd, cwnd)– (and also considers outstanding data)
![Page 8: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/8.jpg)
Polly Huang, NTU EE 8
TCP Self-clocking
PrPb
Ar
Ab
receiversender
As
depends on ACK stream to keep packets flowing
(Redrawn from[Jacobson88a])
packet spacingat receiver
xxx
pck spacing at botteneck
xxxACK spacingat sender
![Page 9: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/9.jpg)
Polly Huang, NTU EE 9
Slow Start
• How do we get the ACK clock started?– Initialize cwnd = 1– Upon receipt of every ACK, cwnd = cwnd + 1
• Implications– how much in each RTT? increase multipliciati
vely (doubles each rtt)– Will overshoot window and cause packet loss(but remember, packet loss is part of the plan)
![Page 10: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/10.jpg)
Polly Huang, NTU EE 10
Slow Start Example
1
one RTT
one pkt time
0R
21R
3
42R
567
83R
91011
1213
1415
1
2 3
4 5 6 7
(redrawn from[Jacobson88a] Fig 2)
![Page 11: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/11.jpg)
Polly Huang, NTU EE 11
Slow Start Time-Sequence Plot
time
Data (KB)
![Page 12: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/12.jpg)
Polly Huang, NTU EE 12
When to End Slow-Start?
• Want to end when the pipe is full– do end when cwnd > ssthresh– start with large ssthresh, but then refine it
• On packet loss– cwnd=1 and go back to slow start– ssthresh = cwnd / 2
• assume that pipe size was somewhere between last good window (cwnd/2) and current window (cwnd)
• Eventually, ssthresh is right and transition to congestion avoidance without packet loss
![Page 13: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/13.jpg)
Polly Huang, NTU EE 13
Congestion Avoidance
• upon receiving ACK– Increase cwnd by 1/cwnd– This is additive increase (over 1 RTT it adds up
to increasing by 1 segment)
• why not multiplicative increase?– growing too fast in equilibrium => oscillations
![Page 14: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/14.jpg)
Polly Huang, NTU EE 14
Congestion Window
time
Congestionwindow
![Page 15: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/15.jpg)
Polly Huang, NTU EE 15
Problems So Far
• have way to fill pipe (slow start)• have way to run at equilibrium (congestion
avoidance)• but tough transition
– no good initial ssthresh– large ssthresh causes packet loss, every time need approaches to quickly recover from packe
t loss (or explicit signal of congestion)
![Page 16: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/16.jpg)
Polly Huang, NTU EE 16
Agenda
• connection setup and teardown
• flow control
• congestion control
• loss recovery
• security
• performance
![Page 17: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/17.jpg)
Polly Huang, NTU EE 17
TCP Loss Recovery
• timeout and retransmit
• fast retransmit
• fast recovery
• New-Reno partial ACKs
• SACK
![Page 18: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/18.jpg)
Polly Huang, NTU EE 18
Fallback Mechanism: Timeout
• retransmission timer (RTO)– if no ACK after RTO fires,
reset cwnd and resend lowest unACK’ed segment
• but they’re very crude– completely stop the ACK clock
– force slow-start again
– are often slow—a long time with no traffic
• …but is there more information?
![Page 19: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/19.jpg)
Polly Huang, NTU EE 19
Digression: RTO Calculation
• Must estimate RTO– don’t know it at start– may change due to congestion or path change
• But need a good estimate– too low => unnecessary retransmits– too high => low utilitization
![Page 20: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/20.jpg)
Polly Huang, NTU EE 20
Initial Round-trip Estimator
Round trip times exponentially averaged:• New RTT = (old RTT) + (1 - ) (new
sample)
• Recommended value for : 0.8 - 0.9
• Retransmit timer set to RTT, where = 2
• Every RTO expiration, increase it multiplicatively
![Page 21: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/21.jpg)
Polly Huang, NTU EE 21
Retransmission Ambiguity
A B
ACK
SampleRTT
A BOriginal transmission
retransmissionSampleRTT
Original transmission
retransmission
ACKRTO RTO
what does the ACK indicate?
![Page 22: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/22.jpg)
Polly Huang, NTU EE 22
Karn’s Retransmission Timeout Estimator
• Accounts for retransmission ambiguity
• If a segment has been retransmitted:– Don’t count RTT sample on ACKs for this seg
ment– Keep backed off time-out for next packet– Reuse RTT estimate only after one successful tr
ansmission
![Page 23: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/23.jpg)
Polly Huang, NTU EE 23
Jacobson’s Retransmission Timeout Estimator
• Key observation:– Using RTT for timeout doesn’t work
(not adaptive enough with fixed : at high loads, variance is high)
• Solution:– If D denotes mean variation (measured)
– Timeout = RTT + 4D
– is now adaptive
(and can do it with integer math in few l.o.c.)
![Page 24: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/24.jpg)
Polly Huang, NTU EE 24
TCP Loss Recovery
• timeout and retransmit
• fast retransmit
• fast recovery
• New-Reno partial ACKs
• SACK
![Page 25: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/25.jpg)
Polly Huang, NTU EE 25
Fast Retransmit
• Interpret n duplicate ACKs as loss indication– in fact, send a dup ACK for every packet you g
et after a missing one– but beware: now packet re-ordering causes pro
blems
• Goal: avoid RTO by fixing the one missing segment
![Page 26: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/26.jpg)
Polly Huang, NTU EE 26
Fast Retransmit Example
fast retransmitafter 3 dup ACKs
from [Fall96a] figure 2
fast retx helps a lot,but not always (if no dup ACKs)
![Page 27: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/27.jpg)
Polly Huang, NTU EE 27
Fast Recovery
• Problem: fast retx still forces slow-start, breaking the ACK clock
• Fast Recovery Solution: artificially inflate the cwnd as more dup ACKs come in– cut cwnd, but instead of slow start, do additive increase
for each ACK
– justification: each dup ACK represents a packet leaving the network, so we can increase cwnd
– exit when out of dup ACKs
![Page 28: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/28.jpg)
Polly Huang, NTU EE 28
Fast Retransmit and Recovery
• If we get 3 duplicate ACKs for segment N– Retransmit segment N
– Set ssthresh to 0.5*cwnd
– Set cwnd to ssthresh + 3 [why?]
• For every subsequent duplicate ACK– Increase cwnd by 1 segment
• When new ACK received– Reset cwnd to ssthresh (resume congestion avoidance)
![Page 29: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/29.jpg)
Polly Huang, NTU EE 29
Fast Recovery Example
fast retransmitafter 3 dup ACKs
fast recoverydue to add’tldup ACKs
![Page 30: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/30.jpg)
Polly Huang, NTU EE 30
New-Reno Partial ACKs
• But fast retx and recovery only repair one lost segment per RTT
• New-Reno idea: use partial ACKs to stay in fast recovery and fix more lost segments
• (But there are diminishing returns here…)
![Page 31: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/31.jpg)
Polly Huang, NTU EE 31
New-Reno Example
fast retransmitafter 3 dup ACKs
fast recoverydue to add’tldup ACKs
additional fast retxand recovery fromNew Reno
from [Fall96a] figure 3
![Page 32: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/32.jpg)
Polly Huang, NTU EE 32
SACK
• Forget these hacks, have receiver just tell sender what’s missing
SACK: selective acknowledgement– use TCP options to encode some info about
multiple losses and avoid all of this guess work– but why is SACK deployment so much slower
than Reno, New-Reno?
![Page 33: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/33.jpg)
Polly Huang, NTU EE 33
Agenda
• connection setup and teardown• flow control• congestion control theory• congestion control practice (in TCP)• loss recovery• putting it together• security• performance
![Page 34: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/34.jpg)
Polly Huang, NTU EE 34
Jacobson Observations
• Compare Figure 3 vs. Figure 4
• Compare Figure 8 vs. Figure 9
![Page 35: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/35.jpg)
Polly Huang, NTU EE 35
Jacobson88a Figure 3: No CC
![Page 36: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/36.jpg)
Polly Huang, NTU EE 36
Jacobson88a Figure 4: with CC
![Page 37: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/37.jpg)
Polly Huang, NTU EE 37
Jacobson88a Figure 8: 4x no CC
![Page 38: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/38.jpg)
Polly Huang, NTU EE 38
Jacobson88a Figure 9: 4x w/CC
![Page 39: Network Protocols: Design and Analysis](https://reader035.vdocuments.us/reader035/viewer/2022062801/568143eb550346895db071f6/html5/thumbnails/39.jpg)
Polly Huang, NTU EE 39
Other questions/observations?
• xxx