ccn2001 Slides4 6pp
ccn2001 Slides4 6pp
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 3 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 4
1
TCP Seq. #’s and ACKs (II) Temporal Redundancy Model
Host A Host B Packets • Sequence Numbers
User Seq=4
• CRC or Checksum
2, A
types CK=7
9, data
‘C’ = ‘C’ Timeout
host ACKs
receipt of Status Reports • ACKs
data
= ‘C’ ‘C’, echoes • NAKs,
3,
79, A CK=4 back ‘C’ • SACKs
Seq=
• Bitmaps
host ACKs
receipt Seq=4 Retransmissions
of echoed 3, A CK=8
‘C’
0 • Packets
• FEC information
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 7 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 8
2
TCP: retransmission scenarios TCP Flow Control
flow control receiver: explicitly
Host A Host B Host A Host B sender won’t overrun informs sender of
Seq=9 Seq=9 receiver’s buffers by free buffer space
2, 8 b 2, 8 b
ytes d ytes d
ata transmitting too much,
– RcvWindow
Seq=92 timeout
ata Seq=
100, too fast
20 by
tes d field in TCP
Seq=100 timeout
timeout
ata
=100
ACK 0 segment
10 RcvBuffer = size or TCP Receive Buffer
X K=
AC CK=1
20
loss A RcvWindow = amount of spare room in Buffer sender: keeps the
Seq=9
2, 8 b
Seq=9
2, 8 b
ytes d
amount of
ytes d ata
ata transmitted,
unACKed data less
20 than most recently
=100 K=1
ACK AC
received
RcvWindow
time time premature timeout,
lost ACK scenario
cumulative ACKs receiver buffering
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 13 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 14
3
TCP Connection Management - 1 TCP Connection Management - 2
Recall: TCP sender, receiver establish Three way handshake:
connection before exchanging data segments
Step 1: client end system sends TCP SYN
• initialize TCP variables: control segment to server
– seq. #s – specifies initial seq #
– buffers, flow control info (e.g. RcvWindow)
• client: connection initiator Step 2: server end system receives SYN,
replies with SYNACK control segment
Socket clientSocket = new Socket("hostname","port
number"); – ACKs received SYN
• server: contacted by client – allocates buffers
Socket connectionSocket = welcomeSocket.accept(); – specifies server-> receiver initial seq. #
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 19 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 20
Fddfdf
Closing a connection: client server
close
FIN
client closes socket: clientSocket.close();
ACK
Step 1: client end system sends TCP FIN
close
ACK
4
TCP Connection Management - 7 Recap: Stability of a Multiplexed System
Average Input Rate > Average Output Rate
=> system is unstable!
5
The Congestion Problem
Principles of Congestion Control
(Continued)
Congestion:
• c) Processors become cheap • informally: “too many sources sending too
(fast routers & switches) much data too fast for network to handle”
• different from flow control (receiver overload)!
A C
S • manifestations:
B D – lost packets (buffer overflow at routers)
Scenario: All links 1 Gb/s.
– long delays (queuing in router buffers)
A & B send to C
=> “high-speed” congestion!! • a top-10 problem!
(lose more packets faster!)
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 32
6
Approaches towards Approaches towards
congestion control - 1 congestion control - 2
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 37 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 38
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 39 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 40
Additive Increase/Multiplicative
TCP congestion control - 3
Decrease (AIMD) Policy
• “Probing” for usable bandwidth: • For stability:
– Window flow control: avoid receiver – rate-of-decrease > rate-of-increase
overrun – Decrease performed “enough” times as
– Dynamic window congestion control: long as congestion exists
avoid/control network overrun • AIMD policy satisfies this condition,
• Policy: provided packet loss is congestion
indicator
– Increase Congwin until loss (congestion)
window
– Loss => decrease Congwin, then begin
probing (increasing) again
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 41 Rensselaer Polytechnic Institute
time
© Shivkumar Kalvanaraman & © Biplab Sikdar 42
7
Fairness Fairness Analysis
bottleneck
TCP
router
connection 2
capacity R
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 43 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 44
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 45 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 46
Congwin++
two segm
ents
until (loss event OR
CongWin > threshold)
four segm
ents
• Exponential increase (per RTT) in window
size (not so slow!)
• Loss event: timeout (Tahoe TCP) and/or
time
three duplicate ACKs (Reno TCP)
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 47 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 48
8
TCP Dynamics TCP Congestion Avoidance - 1
Congestion avoidance
1st RTT 2nd RTT 3rd RTT 4th RTT /* slowstart is over */
/* Congwin > threshold */
• Rate of acks determines rate of Until (loss event) {
every w segments ACKed:
packets : “Self-clocking” property. Congwin++
}
100 Mbps 10 Mbps threshold = Congwin/2
Congwin = 1
Router 1
Q perform slowstart
Receiver Window
Congestion Timeout
Window Idle
ssthresh
(cwnd) Interval
1
Time (units of RTTs)
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 51 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 52
Notation, assumptions:
Q: How long does it take to • Assume one link between client and
receive an object from a Web server of rate R
• Assume: fixed congestion window, W
server after sending a request? segments
• TCP connection establishment • S: MSS (bits)
• data transfer delay • O: object size (bits)
• no retransmissions (no loss, no
corruption)
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 53 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 54
9
TCP latency modeling - 3 TCP latency modeling - 4
Two cases to consider:
• WS/R > RTT + S/R: ACK for first
segment in window returns
before window’s worth of data
sent
Example:
P = min{Q, K − 1}
request
object
first window
= S/R
O/S = 15 segments
RTT
second window
= 2S/R
size. Q=2
fourth window
= 8S/R
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 59 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 60
10
TCP latency modeling: TCP latency modeling:
slow start - 4 slow start - 5
S
+ RTT = time from when server starts to send segment
R P
O
until server receives acknowledgement latency =
R
+ 2 RTT + ∑ stallTime p
p=1
k −1 S O P
S S
= time to transmit the kth window ∑ [ R + RTT − 2
k −1
2 = + 2 RTT + ]
R R k =1 R
O S S
+ = + 2 RTT + P[ RTT + ] − (2 P − 1)
S k −1 S R R R
+ RTT − 2 = stall time after the kth window
R R
Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 61 Rensselaer Polytechnic Institute © Shivkumar Kalvanaraman & © Biplab Sikdar 62
11