lecture 9
DESCRIPTION
Lecture 9. Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012. CS3516: These slides are generated from those made available by the authors of our text. 3.5 connection-oriented transport: TCP segment structure reliable data transfer - PowerPoint PPT PresentationTRANSCRIPT
Introduction 1-1
Lecture 9
Computer Networking A Top Down Approach 6th edition Jim Kurose Keith RossAddison-WesleyMarch 2012
CS3516
These slides are generated from those made available by the authors of our text
Transport Layer 3-2
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-3
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
applicationOS
receiver protocol stack
application may remove data from
TCP socket buffers hellip
hellip slower than TCP receiver is delivering(sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Transport Layer 3-4
TCP flow controlbuffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segments RcvBuffer size set via
socket options (typical default is 4096 bytes)
many operating systems autoadjust RcvBuffer
sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
guarantees receive buffer will not overflow
receiver-side buffering
Transport Layer 3-5
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-6
Connection Managementbefore exchanging data senderreceiver
ldquohandshakerdquo agree to establish connection (each knowing the
other willing to establish connection) agree on connection parameters
connection state ESTABconnection variables
seq client-to-server server-to-clientrcvBuffer size at serverclient
application
network
connection state ESTABconnection Variables
seq client-to-server server-to-clientrcvBuffer size at serverclient
application
network
Socket clientSocket = newSocket(hostnameport
number)
Socket connectionSocket = welcomeSocketaccept()
CS118 2-742605
Blue army
Red army
the well-known ldquotwo-army problemrdquo
Q how can the 2 red armies agree on an attack time
Fact the one who sends a message does not know whether the message is delivered
Basic rule one cannot send an ACK to acknowledge an ACK ndash it goes on forever
Red army
The red armies together can defeat the blue army but separately the blue army wins
Transport Layer 3-8
TCP 3-way handshake
SYNbit=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYNbit=1 Seq=yACKbit=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYN
ACKbit=1 ACKnum=y+1
received SYNACK(x) indicates server is livesend ACK for SYNACK
this segment may contain client-to-server data received ACK(y)
indicates client is live
SYNSENT
ESTAB
SYN RCVD
client state
LISTENserver state
LISTEN
Syn
Ack
Transport Layer 3-9
TCP closing a connection client server each close their side of
connection send TCP segment with FIN bit = 1
respond to received FIN with ACK on receiving FIN ACK can be combined with
own FIN simultaneous FIN exchanges can be
handled
Transport Layer 3-10
FIN_WAIT_2
CLOSE_WAIT
FINbit=1 seq=y
ACKbit=1 ACKnum=y+1
ACKbit=1 ACKnum=x+1 wait for server
closecan stillsend data
can no longersend data
LAST_ACK
CLOSED
TIMED_WAIT
timed wait for 2max
segment lifetime
CLOSED
TCP closing a connection
FIN_WAIT_1 FINbit=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
Fin
Ack
Transport Layer 3-11
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-12
congestion informally ldquotoo many sources sending
too much data too fast for network to handlerdquo
different from flow control manifestations
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem
Principles of congestion control
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-2
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-3
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
applicationOS
receiver protocol stack
application may remove data from
TCP socket buffers hellip
hellip slower than TCP receiver is delivering(sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Transport Layer 3-4
TCP flow controlbuffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segments RcvBuffer size set via
socket options (typical default is 4096 bytes)
many operating systems autoadjust RcvBuffer
sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
guarantees receive buffer will not overflow
receiver-side buffering
Transport Layer 3-5
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-6
Connection Managementbefore exchanging data senderreceiver
ldquohandshakerdquo agree to establish connection (each knowing the
other willing to establish connection) agree on connection parameters
connection state ESTABconnection variables
seq client-to-server server-to-clientrcvBuffer size at serverclient
application
network
connection state ESTABconnection Variables
seq client-to-server server-to-clientrcvBuffer size at serverclient
application
network
Socket clientSocket = newSocket(hostnameport
number)
Socket connectionSocket = welcomeSocketaccept()
CS118 2-742605
Blue army
Red army
the well-known ldquotwo-army problemrdquo
Q how can the 2 red armies agree on an attack time
Fact the one who sends a message does not know whether the message is delivered
Basic rule one cannot send an ACK to acknowledge an ACK ndash it goes on forever
Red army
The red armies together can defeat the blue army but separately the blue army wins
Transport Layer 3-8
TCP 3-way handshake
SYNbit=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYNbit=1 Seq=yACKbit=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYN
ACKbit=1 ACKnum=y+1
received SYNACK(x) indicates server is livesend ACK for SYNACK
this segment may contain client-to-server data received ACK(y)
indicates client is live
SYNSENT
ESTAB
SYN RCVD
client state
LISTENserver state
LISTEN
Syn
Ack
Transport Layer 3-9
TCP closing a connection client server each close their side of
connection send TCP segment with FIN bit = 1
respond to received FIN with ACK on receiving FIN ACK can be combined with
own FIN simultaneous FIN exchanges can be
handled
Transport Layer 3-10
FIN_WAIT_2
CLOSE_WAIT
FINbit=1 seq=y
ACKbit=1 ACKnum=y+1
ACKbit=1 ACKnum=x+1 wait for server
closecan stillsend data
can no longersend data
LAST_ACK
CLOSED
TIMED_WAIT
timed wait for 2max
segment lifetime
CLOSED
TCP closing a connection
FIN_WAIT_1 FINbit=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
Fin
Ack
Transport Layer 3-11
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-12
congestion informally ldquotoo many sources sending
too much data too fast for network to handlerdquo
different from flow control manifestations
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem
Principles of congestion control
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-3
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
applicationOS
receiver protocol stack
application may remove data from
TCP socket buffers hellip
hellip slower than TCP receiver is delivering(sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Transport Layer 3-4
TCP flow controlbuffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segments RcvBuffer size set via
socket options (typical default is 4096 bytes)
many operating systems autoadjust RcvBuffer
sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
guarantees receive buffer will not overflow
receiver-side buffering
Transport Layer 3-5
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-6
Connection Managementbefore exchanging data senderreceiver
ldquohandshakerdquo agree to establish connection (each knowing the
other willing to establish connection) agree on connection parameters
connection state ESTABconnection variables
seq client-to-server server-to-clientrcvBuffer size at serverclient
application
network
connection state ESTABconnection Variables
seq client-to-server server-to-clientrcvBuffer size at serverclient
application
network
Socket clientSocket = newSocket(hostnameport
number)
Socket connectionSocket = welcomeSocketaccept()
CS118 2-742605
Blue army
Red army
the well-known ldquotwo-army problemrdquo
Q how can the 2 red armies agree on an attack time
Fact the one who sends a message does not know whether the message is delivered
Basic rule one cannot send an ACK to acknowledge an ACK ndash it goes on forever
Red army
The red armies together can defeat the blue army but separately the blue army wins
Transport Layer 3-8
TCP 3-way handshake
SYNbit=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYNbit=1 Seq=yACKbit=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYN
ACKbit=1 ACKnum=y+1
received SYNACK(x) indicates server is livesend ACK for SYNACK
this segment may contain client-to-server data received ACK(y)
indicates client is live
SYNSENT
ESTAB
SYN RCVD
client state
LISTENserver state
LISTEN
Syn
Ack
Transport Layer 3-9
TCP closing a connection client server each close their side of
connection send TCP segment with FIN bit = 1
respond to received FIN with ACK on receiving FIN ACK can be combined with
own FIN simultaneous FIN exchanges can be
handled
Transport Layer 3-10
FIN_WAIT_2
CLOSE_WAIT
FINbit=1 seq=y
ACKbit=1 ACKnum=y+1
ACKbit=1 ACKnum=x+1 wait for server
closecan stillsend data
can no longersend data
LAST_ACK
CLOSED
TIMED_WAIT
timed wait for 2max
segment lifetime
CLOSED
TCP closing a connection
FIN_WAIT_1 FINbit=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
Fin
Ack
Transport Layer 3-11
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-12
congestion informally ldquotoo many sources sending
too much data too fast for network to handlerdquo
different from flow control manifestations
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem
Principles of congestion control
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-4
TCP flow controlbuffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segments RcvBuffer size set via
socket options (typical default is 4096 bytes)
many operating systems autoadjust RcvBuffer
sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
guarantees receive buffer will not overflow
receiver-side buffering
Transport Layer 3-5
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-6
Connection Managementbefore exchanging data senderreceiver
ldquohandshakerdquo agree to establish connection (each knowing the
other willing to establish connection) agree on connection parameters
connection state ESTABconnection variables
seq client-to-server server-to-clientrcvBuffer size at serverclient
application
network
connection state ESTABconnection Variables
seq client-to-server server-to-clientrcvBuffer size at serverclient
application
network
Socket clientSocket = newSocket(hostnameport
number)
Socket connectionSocket = welcomeSocketaccept()
CS118 2-742605
Blue army
Red army
the well-known ldquotwo-army problemrdquo
Q how can the 2 red armies agree on an attack time
Fact the one who sends a message does not know whether the message is delivered
Basic rule one cannot send an ACK to acknowledge an ACK ndash it goes on forever
Red army
The red armies together can defeat the blue army but separately the blue army wins
Transport Layer 3-8
TCP 3-way handshake
SYNbit=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYNbit=1 Seq=yACKbit=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYN
ACKbit=1 ACKnum=y+1
received SYNACK(x) indicates server is livesend ACK for SYNACK
this segment may contain client-to-server data received ACK(y)
indicates client is live
SYNSENT
ESTAB
SYN RCVD
client state
LISTENserver state
LISTEN
Syn
Ack
Transport Layer 3-9
TCP closing a connection client server each close their side of
connection send TCP segment with FIN bit = 1
respond to received FIN with ACK on receiving FIN ACK can be combined with
own FIN simultaneous FIN exchanges can be
handled
Transport Layer 3-10
FIN_WAIT_2
CLOSE_WAIT
FINbit=1 seq=y
ACKbit=1 ACKnum=y+1
ACKbit=1 ACKnum=x+1 wait for server
closecan stillsend data
can no longersend data
LAST_ACK
CLOSED
TIMED_WAIT
timed wait for 2max
segment lifetime
CLOSED
TCP closing a connection
FIN_WAIT_1 FINbit=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
Fin
Ack
Transport Layer 3-11
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-12
congestion informally ldquotoo many sources sending
too much data too fast for network to handlerdquo
different from flow control manifestations
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem
Principles of congestion control
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-5
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-6
Connection Managementbefore exchanging data senderreceiver
ldquohandshakerdquo agree to establish connection (each knowing the
other willing to establish connection) agree on connection parameters
connection state ESTABconnection variables
seq client-to-server server-to-clientrcvBuffer size at serverclient
application
network
connection state ESTABconnection Variables
seq client-to-server server-to-clientrcvBuffer size at serverclient
application
network
Socket clientSocket = newSocket(hostnameport
number)
Socket connectionSocket = welcomeSocketaccept()
CS118 2-742605
Blue army
Red army
the well-known ldquotwo-army problemrdquo
Q how can the 2 red armies agree on an attack time
Fact the one who sends a message does not know whether the message is delivered
Basic rule one cannot send an ACK to acknowledge an ACK ndash it goes on forever
Red army
The red armies together can defeat the blue army but separately the blue army wins
Transport Layer 3-8
TCP 3-way handshake
SYNbit=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYNbit=1 Seq=yACKbit=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYN
ACKbit=1 ACKnum=y+1
received SYNACK(x) indicates server is livesend ACK for SYNACK
this segment may contain client-to-server data received ACK(y)
indicates client is live
SYNSENT
ESTAB
SYN RCVD
client state
LISTENserver state
LISTEN
Syn
Ack
Transport Layer 3-9
TCP closing a connection client server each close their side of
connection send TCP segment with FIN bit = 1
respond to received FIN with ACK on receiving FIN ACK can be combined with
own FIN simultaneous FIN exchanges can be
handled
Transport Layer 3-10
FIN_WAIT_2
CLOSE_WAIT
FINbit=1 seq=y
ACKbit=1 ACKnum=y+1
ACKbit=1 ACKnum=x+1 wait for server
closecan stillsend data
can no longersend data
LAST_ACK
CLOSED
TIMED_WAIT
timed wait for 2max
segment lifetime
CLOSED
TCP closing a connection
FIN_WAIT_1 FINbit=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
Fin
Ack
Transport Layer 3-11
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-12
congestion informally ldquotoo many sources sending
too much data too fast for network to handlerdquo
different from flow control manifestations
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem
Principles of congestion control
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-6
Connection Managementbefore exchanging data senderreceiver
ldquohandshakerdquo agree to establish connection (each knowing the
other willing to establish connection) agree on connection parameters
connection state ESTABconnection variables
seq client-to-server server-to-clientrcvBuffer size at serverclient
application
network
connection state ESTABconnection Variables
seq client-to-server server-to-clientrcvBuffer size at serverclient
application
network
Socket clientSocket = newSocket(hostnameport
number)
Socket connectionSocket = welcomeSocketaccept()
CS118 2-742605
Blue army
Red army
the well-known ldquotwo-army problemrdquo
Q how can the 2 red armies agree on an attack time
Fact the one who sends a message does not know whether the message is delivered
Basic rule one cannot send an ACK to acknowledge an ACK ndash it goes on forever
Red army
The red armies together can defeat the blue army but separately the blue army wins
Transport Layer 3-8
TCP 3-way handshake
SYNbit=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYNbit=1 Seq=yACKbit=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYN
ACKbit=1 ACKnum=y+1
received SYNACK(x) indicates server is livesend ACK for SYNACK
this segment may contain client-to-server data received ACK(y)
indicates client is live
SYNSENT
ESTAB
SYN RCVD
client state
LISTENserver state
LISTEN
Syn
Ack
Transport Layer 3-9
TCP closing a connection client server each close their side of
connection send TCP segment with FIN bit = 1
respond to received FIN with ACK on receiving FIN ACK can be combined with
own FIN simultaneous FIN exchanges can be
handled
Transport Layer 3-10
FIN_WAIT_2
CLOSE_WAIT
FINbit=1 seq=y
ACKbit=1 ACKnum=y+1
ACKbit=1 ACKnum=x+1 wait for server
closecan stillsend data
can no longersend data
LAST_ACK
CLOSED
TIMED_WAIT
timed wait for 2max
segment lifetime
CLOSED
TCP closing a connection
FIN_WAIT_1 FINbit=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
Fin
Ack
Transport Layer 3-11
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-12
congestion informally ldquotoo many sources sending
too much data too fast for network to handlerdquo
different from flow control manifestations
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem
Principles of congestion control
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
CS118 2-742605
Blue army
Red army
the well-known ldquotwo-army problemrdquo
Q how can the 2 red armies agree on an attack time
Fact the one who sends a message does not know whether the message is delivered
Basic rule one cannot send an ACK to acknowledge an ACK ndash it goes on forever
Red army
The red armies together can defeat the blue army but separately the blue army wins
Transport Layer 3-8
TCP 3-way handshake
SYNbit=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYNbit=1 Seq=yACKbit=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYN
ACKbit=1 ACKnum=y+1
received SYNACK(x) indicates server is livesend ACK for SYNACK
this segment may contain client-to-server data received ACK(y)
indicates client is live
SYNSENT
ESTAB
SYN RCVD
client state
LISTENserver state
LISTEN
Syn
Ack
Transport Layer 3-9
TCP closing a connection client server each close their side of
connection send TCP segment with FIN bit = 1
respond to received FIN with ACK on receiving FIN ACK can be combined with
own FIN simultaneous FIN exchanges can be
handled
Transport Layer 3-10
FIN_WAIT_2
CLOSE_WAIT
FINbit=1 seq=y
ACKbit=1 ACKnum=y+1
ACKbit=1 ACKnum=x+1 wait for server
closecan stillsend data
can no longersend data
LAST_ACK
CLOSED
TIMED_WAIT
timed wait for 2max
segment lifetime
CLOSED
TCP closing a connection
FIN_WAIT_1 FINbit=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
Fin
Ack
Transport Layer 3-11
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-12
congestion informally ldquotoo many sources sending
too much data too fast for network to handlerdquo
different from flow control manifestations
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem
Principles of congestion control
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-8
TCP 3-way handshake
SYNbit=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYNbit=1 Seq=yACKbit=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYN
ACKbit=1 ACKnum=y+1
received SYNACK(x) indicates server is livesend ACK for SYNACK
this segment may contain client-to-server data received ACK(y)
indicates client is live
SYNSENT
ESTAB
SYN RCVD
client state
LISTENserver state
LISTEN
Syn
Ack
Transport Layer 3-9
TCP closing a connection client server each close their side of
connection send TCP segment with FIN bit = 1
respond to received FIN with ACK on receiving FIN ACK can be combined with
own FIN simultaneous FIN exchanges can be
handled
Transport Layer 3-10
FIN_WAIT_2
CLOSE_WAIT
FINbit=1 seq=y
ACKbit=1 ACKnum=y+1
ACKbit=1 ACKnum=x+1 wait for server
closecan stillsend data
can no longersend data
LAST_ACK
CLOSED
TIMED_WAIT
timed wait for 2max
segment lifetime
CLOSED
TCP closing a connection
FIN_WAIT_1 FINbit=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
Fin
Ack
Transport Layer 3-11
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-12
congestion informally ldquotoo many sources sending
too much data too fast for network to handlerdquo
different from flow control manifestations
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem
Principles of congestion control
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-9
TCP closing a connection client server each close their side of
connection send TCP segment with FIN bit = 1
respond to received FIN with ACK on receiving FIN ACK can be combined with
own FIN simultaneous FIN exchanges can be
handled
Transport Layer 3-10
FIN_WAIT_2
CLOSE_WAIT
FINbit=1 seq=y
ACKbit=1 ACKnum=y+1
ACKbit=1 ACKnum=x+1 wait for server
closecan stillsend data
can no longersend data
LAST_ACK
CLOSED
TIMED_WAIT
timed wait for 2max
segment lifetime
CLOSED
TCP closing a connection
FIN_WAIT_1 FINbit=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
Fin
Ack
Transport Layer 3-11
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-12
congestion informally ldquotoo many sources sending
too much data too fast for network to handlerdquo
different from flow control manifestations
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem
Principles of congestion control
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-10
FIN_WAIT_2
CLOSE_WAIT
FINbit=1 seq=y
ACKbit=1 ACKnum=y+1
ACKbit=1 ACKnum=x+1 wait for server
closecan stillsend data
can no longersend data
LAST_ACK
CLOSED
TIMED_WAIT
timed wait for 2max
segment lifetime
CLOSED
TCP closing a connection
FIN_WAIT_1 FINbit=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
Fin
Ack
Transport Layer 3-11
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-12
congestion informally ldquotoo many sources sending
too much data too fast for network to handlerdquo
different from flow control manifestations
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem
Principles of congestion control
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-11
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
Transport Layer 3-12
congestion informally ldquotoo many sources sending
too much data too fast for network to handlerdquo
different from flow control manifestations
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem
Principles of congestion control
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-12
congestion informally ldquotoo many sources sending
too much data too fast for network to handlerdquo
different from flow control manifestations
lost packets (buffer overflow at routers)
long delays (queueing in router buffers)
a top-10 problem
Principles of congestion control
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-13
Causescosts of congestion scenario 1 two senders two
receivers one router infinite
buffers output link capacity
R no retransmission
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2de
lay
lin large delays as arrival
rate lin approaches capacity
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-14
one router finite buffers sender retransmission of timed-out
packet application-layer input = application-layer
output lin = lout transport-layer input includes retransmissions
lin lin
finite shared output link buffers
Host A
lin original data
Host B
loutlin original data plus retransmitted data
lsquo
Causescosts of congestion scenario 2
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-15
idealization perfect knowledge
sender sends only when router buffers available
finite shared output link buffers
lin original dataloutlin original data plus
retransmitted data
copy
free buffer space
R2
R2
l out
lin
Causescosts of congestion scenario 2
Host B
A
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-16
lin original dataloutlin original data plus
retransmitted data
copy
no buffer space
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
Causescosts of congestion scenario 2
A
Host B
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-17
lin original dataloutlin original data plus
retransmitted data
free buffer space
Causescosts of congestion scenario 2
Idealization known loss packets can be lost dropped at router due to full buffers
sender only resends if packet known to be lost
R2
R2lin
l out
when sending at R2 some packets are retransmissions but asymptotic goodput is still R2 (why)
A
Host B
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-18
A
lin loutlincopy
free buffer space
timeout
R2
R2lin
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
Host B
Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Causescosts of congestion scenario 2
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-19
R2
l out
when sending at R2 some packets are retransmissions including duplicated that are delivered
ldquocostsrdquo of congestion more work (retrans) for given ldquogoodputrdquo unneeded retransmissions link carries multiple
copies of pkt decreasing goodput
R2lin
Causescosts of congestion scenario 2 Realistic duplicates packets can be lost
dropped at router due to full buffers
sender times out prematurely sending two copies both of which are delivered
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-20
four senders multihop paths timeoutretransmit
Q what happens as lin and lin
rsquo increase
finite shared output link buffers
Host A lout
Causescosts of congestion scenario 3
Host B
Host CHost D
lin original data
lin original data plus retransmitted data
A as red linrsquo increases all
arriving blue pkts at upper queue are dropped blue throughput g 0
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-21
another ldquocostrdquo of congestion when packet dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
C2
l out
linrsquo
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-22
Approaches towards congestion controltwo broad approaches towards congestion
controlend-end
congestion control
no explicit feedback from network
congestion inferred from end-system observed loss delay
approach taken by TCP
network-assisted congestion control
routers provide feedback to end systemssingle bit indicating congestion (SNA DECbit TCPIP ECN ATM)
explicit rate for sender to send at
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-23
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-24
TCP congestion control additive increase multiplicative decrease
approach sender increases transmission rate (window size) probing for usable bandwidth until loss occurs additive increase increase cwnd by 1
MSS every RTT until loss detectedmultiplicative decrease cut cwnd in half
after loss
cwnd
TCP
sen
der
cong
estio
n w
indo
w s
ize
AIMD saw toothbehavior probing
for bandwidth
additively increase window size helliphellip until loss occurs (then cut window in half)
time
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-25
TCP Congestion Control details
sender limits transmission
cwnd is dynamic function of perceived network congestion
TCP sending rate roughly send
cwnd bytes wait RTT for ACKS then send more bytes
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
cwnd
LastByteSent-LastByteAcked
lt cwnd
sender sequence number space
rate ~~cwndRTT bytessec
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-26
TCP Slow Start when connection
begins increase rate exponentially until first loss event initially cwnd = 1
MSS double cwnd every
RTT done by
incrementing cwnd for every ACK received
summary initial rate is slow but ramps up exponentially fast
Host A
one segment
RTT
Host B
time
two segments
four segments
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-27
TCP detecting reacting to loss
loss indicated by timeout cwnd set to 1 MSS window then grows exponentially (as in
slow start) to threshold then grows linearly
loss indicated by 3 duplicate ACKs TCP RENO dup ACKs indicate network capable of
delivering some segments cwnd is cut in half window then grows
linearly TCP Tahoe always sets cwnd to 1
(timeout or 3 duplicate acks)
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-28
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh on loss event ssthresh is set to 12 of cwnd just before loss event
TCP switching from slow start to CA
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-29
Summary TCP Congestion Control
timeoutssthresh = cwnd2cwnd = 1 MSSdupACKcount = 0retransmit missing segment
Lcwnd gt ssthresh
congestionavoidance
cwnd = cwnd + MSS (MSScwnd)dupACKcount = 0transmit new segment(s) as allowed
new ACK
dupACKcount++duplicate ACK
fastrecovery
cwnd = cwnd + MSStransmit new segment(s) as allowed
duplicate ACK
ssthresh= cwnd2cwnd = ssthresh + 3
retransmit missing segment
dupACKcount == 3
timeoutssthresh = cwnd2cwnd = 1 dupACKcount = 0retransmit missing segment
ssthresh= cwnd2cwnd = ssthresh + 3retransmit missing segment
dupACKcount == 3cwnd = ssthreshdupACKcount = 0
New ACK
slow start
timeoutssthresh = cwnd2 cwnd = 1 MSSdupACKcount = 0retransmit missing segment
cwnd = cwnd+MSSdupACKcount = 0transmit new segment(s) as allowed
new ACKdupACKcount++duplicate ACK
Lcwnd = 1 MSSssthresh = 64 KBdupACKcount = 0
NewACK
NewACK
NewACK
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-30
TCP throughput avg TCP thruput as function of window
size RTT ignore slow start assume always data to send
W window size (measured in bytes) where loss occurs avg window size ( in-flight bytes) is frac34 W avg thruput is 34W per RTT
W
W2
avg TCP thruput = 34WRTTbytessec
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-31
TCP Futures TCP over ldquolong fat pipesrdquo example 1500 byte segments 100ms
RTT want 10 Gbps throughput requires W = 83333 in-flight segments throughput in terms of segment loss
probability L [Mathis 1997]
to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate
new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-32
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Network Layer 4-33
123
IP destination address in arriving packetrsquos header
routing algorithm
local forwarding tabledest address output
linkaddress-range 1address-range 2address-range 3address-range 4
3221
Interplay between routing forwarding
routing algorithm determinesend-end-path through networkforwarding table determineslocal forwarding at this router
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Network Layer 4-34
u
yx
wv
z2
21 3
1
12
53
5
graph G = (NE)
N = set of routers = u v w x y z
E = set of links = (uv) (ux) (vx) (vw) (xw) (xy) (wy) (wz) (yz)
Graph abstraction
aside graph abstraction is useful in other network contexts eg P2P where N is set of peers and E is set of TCP connections
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Network Layer 4-35
Graph abstraction costs
u
yx
wv
z2
21 3
1
12
53
5 c(xxrsquo) = cost of link (xxrsquo) eg c(wz) = 5
cost could always be 1 or inversely related to bandwidthor inversely related to congestion
cost of path (x1 x2 x3hellip xp) = c(x1x2) + c(x2x3) + hellip + c(xp-1xp)
key question what is the least-cost path between u and z routing algorithm algorithm that finds that least cost path
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Network Layer 4-36
Routing algorithm classificationQ global or decentralized
informationglobal all routers have
complete topology link cost info
ldquolink staterdquo algorithmsdecentralized router knows
physically-connected neighbors link costs to neighbors
iterative process of computation exchange of info with neighbors
ldquodistance vectorrdquo algorithms
Q static or dynamic
static routes change slowly
over timedynamic routes change more
quickly periodic update in response to link
cost changes
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Transport Layer 3-37
Lecture 9 outline35 connection-
oriented transport TCP segment structure reliable data
transfer flow control connection
management36 principles of
congestion control37 TCP congestion
control
45 routing algorithms link state distance vector hierarchical routing
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Network Layer 4-38
A Link-State Routing AlgorithmDijkstrarsquos algorithm net topology link
costs known to all nodes accomplished via ldquolink
state broadcastrdquo all nodes have same
info computes least cost
paths from one node (lsquosourcerdquo) to all other nodes gives forwarding table
for that node iterative after k
iterations know least cost path to k destrsquos
notation c(xy) link cost from node x to y = infin if not
direct neighbors D(v) current value of cost of path from source
to dest v p(v) predecessor node along path from source
to v N set of nodes whose least cost path
definitively known
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Network Layer 4-39
Dijsktrarsquos Algorithm1 Initialization 2 N = u 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(uv) 6 else D(v) = infin 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N 12 D(v) = min( D(v) D(w) + c(wv) ) 13 new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v 15 until all nodes in N
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Network Layer 4-40
w3
4
v
x
u
5
37 4
y8
z2
7
9
Dijkstrarsquos algorithm exampleStep N
D(v)p(v)
012345
D(w)p(w)
D(x)p(x)
D(y)p(y)
D(z)p(z)
u infin infin 7u 3u 5uuw infin 11w 6w 5u
14x 11w 6wuwxuwxv 14x 10v
uwxvy 12y
notes construct shortest path
tree by tracing predecessor nodes
ties can exist (can be broken arbitrarily)
uwxvyz
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Network Layer 4-41
Dijkstrarsquos algorithm another example
Step012345
Nu
uxuxy
uxyvuxyvw
uxyvwz
D(v)p(v)2u2u2u
D(w)p(w)5u4x3y3y
D(x)p(x)1u
D(y)p(y)infin
2x
D(z)p(z)infin infin 4y4y4y
u
yx
wv
z2
21 3
1
12
53
5
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Network Layer 4-42
Dijkstrarsquos algorithm example (2)
u
yx
wv
z
resulting shortest-path tree from u
vxywz
(uv)(ux)(ux)(ux)(ux)
destination link
resulting forwarding table in u
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
Network Layer 4-43
Dijkstrarsquos algorithm discussionalgorithm complexity n nodes each iteration need to check all nodes w
not in N n(n+1)2 comparisons O(n2) more efficient implementations possible
O(nlogn)oscillations possible eg support link cost equals amount of
carried trafficAD
C
B1 1+e
e0
e1 1
0 0
initially
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
AD
C
B
given these costsfind new routinghellip
resulting in new costs
0 2+e
1+e10 0
AD
C
B
given these costsfind new routinghellip
resulting in new costs
2+e 0
001+e 1
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-
The End is Near
- Slide 1
- Lecture 9 outline
- TCP flow control
- TCP flow control (2)
- Lecture 9 outline (2)
- Connection Management
- the well-known ldquotwo-army problemrdquo
- TCP 3-way handshake
- TCP closing a connection
- TCP closing a connection (2)
- Lecture 9 outline (3)
- Principles of congestion control
- Causescosts of congestion scenario 1
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 2 (2)
- Causescosts of congestion scenario 2 (3)
- Causescosts of congestion scenario 2 (4)
- Causescosts of congestion scenario 2 (5)
- Causescosts of congestion scenario 2 (6)
- Causescosts of congestion scenario 3
- Causescosts of congestion scenario 3 (2)
- Approaches towards congestion control
- Lecture 9 outline (4)
- TCP congestion control additive increase multiplicative decrea
- TCP Congestion Control details
- TCP Slow Start
- TCP detecting reacting to loss
- TCP switching from slow start to CA
- Summary TCP Congestion Control
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Lecture 9 outline (5)
- Interplay between routing forwarding
- Graph abstraction
- Graph abstraction costs
- Routing algorithm classification
- Lecture 9 outline (6)
- A Link-State Routing Algorithm
- Dijsktrarsquos Algorithm
- Slide 40
- Dijkstrarsquos algorithm another example
- Dijkstrarsquos algorithm example (2)
- Dijkstrarsquos algorithm discussion
- The End is Near
-