Académique Documents
Professionnel Documents
Culture Documents
Transport Layer II
Data over TCP
Rodrigo Fonseca
Based
partly
on
lecture
notes
by
David
Mazières,
Phil
Levis,
John
Janno<
CLOSED
Last Class
Passive open Close
Close
LISTEN
• Introduction to TCP
– Header format SYN/SYN + ACKSYN/SYN + ACKSend/SYN
SYN_RCVD SY
– Connection state diagram
ACK SYN + ACK/ACK
• Today: sending data
Close/FIN ESTABLISHED
Close/FIN FIN/ACK
FIN_WAIT_1 CL
A FIN/ACK
ACK C
K
+
First Goal
TCP TCP
LastByteWritten LastByteRead
TCP TCP
LastByteWritten LastByteRead
• 3 Key Challenges
– Determining the available capacity in the first place
– Adjusting to changes in the available capacity
– Sharing capacity between flows
• Idea
– Each source determines network capacity for itself
– Rate is determined by window size
– Uses implicit feedback (drops, delay)
– ACKs pace transmission (self-clocking)
Dealing with Congestion
Bursts of Packets
Figure 3: Startup behavior of TCP without Slow-start
70
•
•••
•••
•
•• •• •
••• •••
60
•• ••
• ••• •••
••• •• ••
••• •• ••• ••
•• ••• ••• •• •••
• ••
•• •• ••• •••
••• ••• •• • •
•
• ••• •••
50
•
•• ••• ••
••• •• •••
• • ••
Packet Sequence Number (KB)
••• ••• •• •
••• ••
••
••
•
• ••
•• ••
•• •• ••• • •
• ••• •
40
•• •••
•• •• ••
••• •• •••
•• •• ••
• •• ••
••• • ••
•• ••• ••
•• •• •
•• •• •••
•• •• ••
30
•• •• ••
••• •••
••• ••
• •
• •• •
••• ••
••• •••
•• •••
•• ••
20
•• •••
•
••
••• ••
• •••
••• •
••
••
••
••
10
••• •
••
••
••
••
••
•••
•••
••
0
0 2 4 6 8 10
Send Time (sec)
160
Startup behavior
Figure 4: Startup with
behavior of TCP Slow Start
with Slow-start
••
•••••
•••
•• ••
140
•
••• •• •
•••••
•••
•••••
••
•••
120
••
••
•••••
•••
Packet Sequence Number (KB)
••• •
•••
100
•••••
••
•• •••
••
•••••
•••
80
•••••
••
• •••
•
•••
•••••
60
••
•• •••
•••
•••••
•••
••••
40
• •
• ••
••••
•••
•
•••••
• ••
••••
20
•
•• ••
•
•
•
•• ••
••• •••
• • •
0
0 2 4 6 8 10
Send Time (sec)
Same conditions as the previous figure (same time of day, same Suns, same network path,
Slow start implementation
Fair:
A
=
B
Flow
Rate
B
Efficient: A+B = C
Flow
Rate
A
Chiu Jain Phase Plots
Fair:
A
=
B
MI
MD
Flow
Rate
B
Efficient: A+B = C
Flow
Rate
A
Chiu Jain Phase Plots
Fair:
A
=
B
AI
AD
Flow
Rate
B
Efficient: A+B = C
Flow
Rate
A
Chiu Jain Phase Plots
Fair:
A
=
B
AI
MD
Flow
Rate
B
Efficient: A+B = C
Flow
Rate
A
AIMD Implementation
• In practice, send MSS-sized segments
– Let window size in bytes be w (a multiple of MSS)
• Increase:
– Aer w bytes ACKed, could set w = w + MSS
– Smoother to increment on each ACK
• w = w + MSS * MSS/w
• (receive w/MSS ACKs per RTT, increase by MSS/(w/MSS) for
each)
• Decrease:
– Aer a packet loss, w = w/2
– But don’t want w < MSS
– So react differently to multiple consecutive losses
– Back off exponentially (pause with no packets in flight)
AIMD Trace
30
20
10
1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0
Time (seconds)
Putting it together
cwnd
Timeout
Timeout
AIMD
AIMD
ssthresh
• ••
•
••
8
•
RTT (sec.)
•
•
6
•
•
•••• •
• •••
•• •
••• ••
• ••
4
• •• • ••• •• • •
• • • •
• •
• • • • •
•• •
•• • • • •
• • •• •••••• • •
• • • ••• •• •
•• • • •• •
2
• ••• •
• •• • •
0
0 10 20 30 40 50 60 70 80 90 100 110
Packet
3 ADAPTING TO THE PATH: CONGESTION AVOIDANCE 8
• ••
•
••
8
•
RTT (sec.)
•
•
6
•
•
•••• •
• •••
•• •
••• ••
• ••
4
• •• • ••• •• • •
• • • •
• •
• • • • •
•• •
•• • • • •
• • •• •••••• • •
• • • ••• •• •
•• • • •• •
2
• ••• •
• •• • •
0
0 10 20 30 40 50 60 70 80 90 100 110
Packet
Same data as above but the solid line shows a retransmit timer computed according to the
Slow start every time?!
cwnd
AI/MD
Slow Start
Fast retransmit
Time
3 Challenges Revisited
• Determining the available capacity in the first
place
– Exponential increase in congestion window
• Adjusting to changes in the available capacity
– Slow probing, AIMD
• Sharing capacity between flows
– AIMD
• Detecting Congestion
– Timeout based on RTT
– Triple duplicate acknowledgments
• Fast retransmit/Fast recovery
– Reduces slow starts, timeouts
Next Class