marina papatriantafilou – transport layer part2 based on the book computer networking: a top down...
TRANSCRIPT
Marina Papatriantafilou ndash Transport layer part2
Based on the book Computer Networking A Top Down Approach Jim Kurose Keith Ross Addison-Wesley
Course on Computer Communication and Networks
Lecture 5 Chapter 3 Transport Layer Part B
EDA344DIT 420 CTHGU
1
Marina Papatriantafilou ndash Transport layer part2 3b-3
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-4
TCP Overview RFCs 79311221323 2018 5681 full duplex data
bi-directional data flow in same connection
MSS maximum segment size
connection-oriented handshaking (exchange of control
msgs) inits sender amp receiver state before data exchange
flow control sender will not overwhelm
receiver
congestion control sender will not flood network with
traffic (but still try to maximize throughput)
bull point-to-pointndash one sender one receiver
bull reliable in-order byte steam
bull pipelinedndash TCP congestion and flow
control set window size
socketdoor
T C Psend buffer
T C Preceive buffer
socketdoor
segm ent
applicationwrites data
applicationreads data
Marina Papatriantafilou ndash Transport layer part2 3-5
TCP segment structure
dest port
32 bits
sequence number
acknowledgement number
receive window
Urg data pointerchecksum
FSRPAUheadlen
notused
options (variable length)
ACK ACK valid
URG urgent data (generally not used)
PSH push data now(generally not used)
RST SYN FINconnection estab(setup teardown
commands)
countingby bytes of data(not segments)
Internetchecksum
(as in UDP)
bytes rcvr willingto accept(flow control)
applicationdata (variable length)
source port
Marina Papatriantafilou ndash Transport layer part2 3b-6
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-7
TCP seq numbers ACKs
sequence numbersndashldquonumberrdquo of first byte in
segmentrsquos dataacknowledgements
ndashseq of next byte expected from other side
ndashcumulative ACKsource port dest port
sequence number
acknowledgement number
checksum
rwnd
incoming segment to sender
A
sent ACKed
sent not-yet ACKed(ldquoin-flightrdquo)
usablebut not yet sent
not usable
window size N
sender sequence number space
source port dest port
sequence number
acknowledgement number
checksum
rwnd
outgoing segment from sender
Marina Papatriantafilou ndash Transport layer part2 3-8
TCP seq numbers ACKs
Usertypes
lsquoCrsquo
host ACKs receipt
of echoed lsquoCrsquo
host ACKs receipt of lsquoCrsquo echoes back lsquoCrsquo
Simple example scenarioBased on telnet msg exchange
Host BHost A
Seq=42 ACK=79 data = lsquoCrsquo
Seq=79 ACK=43 data = lsquoCrsquo
Seq=43 ACK=80
Always ack next in-order expected byte
Marina Papatriantafilou ndash Transport layer part2 3-9
TCP cumulative Ack - retransmission scenarios
Cumulative ACK (Premature) timeout
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=92 8bytes of data
tim
eout
ACK=120
Seq=100 20 bytes of data
ACK=120
SendBase=100
SendBase=120
SendBase=120
SendBase=92
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=120 15 bytes of data
tim
eout
Seq=100 20 bytes of data
ACK=120
Marina Papatriantafilou ndash Transport layer part2 3b-10
TCP ACK generation [RFC 1122 RFC 5681]
Event
in-order segment arrival no gapseverything else already ACKed
in-order segment arrival no gapsone delayed ACK pending
out-of-order segment arrivalhigher-than-expect seq gap detected
arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
immediately send singlecumulative ACK
send (duplicate) ACK indicating seq of next expected byte
immediate send ACK if segment startsat lower end of gap
Marina Papatriantafilou ndash Transport layer part2 3b-12
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 13
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
segment
segment
TCP round trip time timeout (1)
Q how to set TCP timeout value
longer than RTT but RTT varies
too short premature timeout unnecessary retransmissions
too long slow reaction to segment loss
Marina Papatriantafilou ndash Transport layer part2 3-14
EstimatedRTT = (1-)EstimatedRTT + SampleRTT
TCP round trip time timeout (2)
exponential weighted moving average influence of past sample decreases exponentially fast
typical value = 0125
DevRTT = (1-)DevRTT + |SampleRTT-EstimatedRTT|
(typically = 025)
TimeoutInterval = EstimatedRTT + 4DevRTT
estimated RTT ldquosafety marginrdquo
RTT gaiacsumassedu to fantasiaeurecomfr
100
150
200
250
300
350
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
RTT
(mill
isec
onds
)SampleRTT Estimated RTT
RTT (
mill
iseco
nds)
RTT gaiacsumassedu to fantasiaeurecomfr
sampleRTTEstimatedRTT
time (seconds)
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3b-3
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-4
TCP Overview RFCs 79311221323 2018 5681 full duplex data
bi-directional data flow in same connection
MSS maximum segment size
connection-oriented handshaking (exchange of control
msgs) inits sender amp receiver state before data exchange
flow control sender will not overwhelm
receiver
congestion control sender will not flood network with
traffic (but still try to maximize throughput)
bull point-to-pointndash one sender one receiver
bull reliable in-order byte steam
bull pipelinedndash TCP congestion and flow
control set window size
socketdoor
T C Psend buffer
T C Preceive buffer
socketdoor
segm ent
applicationwrites data
applicationreads data
Marina Papatriantafilou ndash Transport layer part2 3-5
TCP segment structure
dest port
32 bits
sequence number
acknowledgement number
receive window
Urg data pointerchecksum
FSRPAUheadlen
notused
options (variable length)
ACK ACK valid
URG urgent data (generally not used)
PSH push data now(generally not used)
RST SYN FINconnection estab(setup teardown
commands)
countingby bytes of data(not segments)
Internetchecksum
(as in UDP)
bytes rcvr willingto accept(flow control)
applicationdata (variable length)
source port
Marina Papatriantafilou ndash Transport layer part2 3b-6
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-7
TCP seq numbers ACKs
sequence numbersndashldquonumberrdquo of first byte in
segmentrsquos dataacknowledgements
ndashseq of next byte expected from other side
ndashcumulative ACKsource port dest port
sequence number
acknowledgement number
checksum
rwnd
incoming segment to sender
A
sent ACKed
sent not-yet ACKed(ldquoin-flightrdquo)
usablebut not yet sent
not usable
window size N
sender sequence number space
source port dest port
sequence number
acknowledgement number
checksum
rwnd
outgoing segment from sender
Marina Papatriantafilou ndash Transport layer part2 3-8
TCP seq numbers ACKs
Usertypes
lsquoCrsquo
host ACKs receipt
of echoed lsquoCrsquo
host ACKs receipt of lsquoCrsquo echoes back lsquoCrsquo
Simple example scenarioBased on telnet msg exchange
Host BHost A
Seq=42 ACK=79 data = lsquoCrsquo
Seq=79 ACK=43 data = lsquoCrsquo
Seq=43 ACK=80
Always ack next in-order expected byte
Marina Papatriantafilou ndash Transport layer part2 3-9
TCP cumulative Ack - retransmission scenarios
Cumulative ACK (Premature) timeout
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=92 8bytes of data
tim
eout
ACK=120
Seq=100 20 bytes of data
ACK=120
SendBase=100
SendBase=120
SendBase=120
SendBase=92
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=120 15 bytes of data
tim
eout
Seq=100 20 bytes of data
ACK=120
Marina Papatriantafilou ndash Transport layer part2 3b-10
TCP ACK generation [RFC 1122 RFC 5681]
Event
in-order segment arrival no gapseverything else already ACKed
in-order segment arrival no gapsone delayed ACK pending
out-of-order segment arrivalhigher-than-expect seq gap detected
arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
immediately send singlecumulative ACK
send (duplicate) ACK indicating seq of next expected byte
immediate send ACK if segment startsat lower end of gap
Marina Papatriantafilou ndash Transport layer part2 3b-12
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 13
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
segment
segment
TCP round trip time timeout (1)
Q how to set TCP timeout value
longer than RTT but RTT varies
too short premature timeout unnecessary retransmissions
too long slow reaction to segment loss
Marina Papatriantafilou ndash Transport layer part2 3-14
EstimatedRTT = (1-)EstimatedRTT + SampleRTT
TCP round trip time timeout (2)
exponential weighted moving average influence of past sample decreases exponentially fast
typical value = 0125
DevRTT = (1-)DevRTT + |SampleRTT-EstimatedRTT|
(typically = 025)
TimeoutInterval = EstimatedRTT + 4DevRTT
estimated RTT ldquosafety marginrdquo
RTT gaiacsumassedu to fantasiaeurecomfr
100
150
200
250
300
350
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
RTT
(mill
isec
onds
)SampleRTT Estimated RTT
RTT (
mill
iseco
nds)
RTT gaiacsumassedu to fantasiaeurecomfr
sampleRTTEstimatedRTT
time (seconds)
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-4
TCP Overview RFCs 79311221323 2018 5681 full duplex data
bi-directional data flow in same connection
MSS maximum segment size
connection-oriented handshaking (exchange of control
msgs) inits sender amp receiver state before data exchange
flow control sender will not overwhelm
receiver
congestion control sender will not flood network with
traffic (but still try to maximize throughput)
bull point-to-pointndash one sender one receiver
bull reliable in-order byte steam
bull pipelinedndash TCP congestion and flow
control set window size
socketdoor
T C Psend buffer
T C Preceive buffer
socketdoor
segm ent
applicationwrites data
applicationreads data
Marina Papatriantafilou ndash Transport layer part2 3-5
TCP segment structure
dest port
32 bits
sequence number
acknowledgement number
receive window
Urg data pointerchecksum
FSRPAUheadlen
notused
options (variable length)
ACK ACK valid
URG urgent data (generally not used)
PSH push data now(generally not used)
RST SYN FINconnection estab(setup teardown
commands)
countingby bytes of data(not segments)
Internetchecksum
(as in UDP)
bytes rcvr willingto accept(flow control)
applicationdata (variable length)
source port
Marina Papatriantafilou ndash Transport layer part2 3b-6
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-7
TCP seq numbers ACKs
sequence numbersndashldquonumberrdquo of first byte in
segmentrsquos dataacknowledgements
ndashseq of next byte expected from other side
ndashcumulative ACKsource port dest port
sequence number
acknowledgement number
checksum
rwnd
incoming segment to sender
A
sent ACKed
sent not-yet ACKed(ldquoin-flightrdquo)
usablebut not yet sent
not usable
window size N
sender sequence number space
source port dest port
sequence number
acknowledgement number
checksum
rwnd
outgoing segment from sender
Marina Papatriantafilou ndash Transport layer part2 3-8
TCP seq numbers ACKs
Usertypes
lsquoCrsquo
host ACKs receipt
of echoed lsquoCrsquo
host ACKs receipt of lsquoCrsquo echoes back lsquoCrsquo
Simple example scenarioBased on telnet msg exchange
Host BHost A
Seq=42 ACK=79 data = lsquoCrsquo
Seq=79 ACK=43 data = lsquoCrsquo
Seq=43 ACK=80
Always ack next in-order expected byte
Marina Papatriantafilou ndash Transport layer part2 3-9
TCP cumulative Ack - retransmission scenarios
Cumulative ACK (Premature) timeout
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=92 8bytes of data
tim
eout
ACK=120
Seq=100 20 bytes of data
ACK=120
SendBase=100
SendBase=120
SendBase=120
SendBase=92
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=120 15 bytes of data
tim
eout
Seq=100 20 bytes of data
ACK=120
Marina Papatriantafilou ndash Transport layer part2 3b-10
TCP ACK generation [RFC 1122 RFC 5681]
Event
in-order segment arrival no gapseverything else already ACKed
in-order segment arrival no gapsone delayed ACK pending
out-of-order segment arrivalhigher-than-expect seq gap detected
arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
immediately send singlecumulative ACK
send (duplicate) ACK indicating seq of next expected byte
immediate send ACK if segment startsat lower end of gap
Marina Papatriantafilou ndash Transport layer part2 3b-12
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 13
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
segment
segment
TCP round trip time timeout (1)
Q how to set TCP timeout value
longer than RTT but RTT varies
too short premature timeout unnecessary retransmissions
too long slow reaction to segment loss
Marina Papatriantafilou ndash Transport layer part2 3-14
EstimatedRTT = (1-)EstimatedRTT + SampleRTT
TCP round trip time timeout (2)
exponential weighted moving average influence of past sample decreases exponentially fast
typical value = 0125
DevRTT = (1-)DevRTT + |SampleRTT-EstimatedRTT|
(typically = 025)
TimeoutInterval = EstimatedRTT + 4DevRTT
estimated RTT ldquosafety marginrdquo
RTT gaiacsumassedu to fantasiaeurecomfr
100
150
200
250
300
350
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
RTT
(mill
isec
onds
)SampleRTT Estimated RTT
RTT (
mill
iseco
nds)
RTT gaiacsumassedu to fantasiaeurecomfr
sampleRTTEstimatedRTT
time (seconds)
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-5
TCP segment structure
dest port
32 bits
sequence number
acknowledgement number
receive window
Urg data pointerchecksum
FSRPAUheadlen
notused
options (variable length)
ACK ACK valid
URG urgent data (generally not used)
PSH push data now(generally not used)
RST SYN FINconnection estab(setup teardown
commands)
countingby bytes of data(not segments)
Internetchecksum
(as in UDP)
bytes rcvr willingto accept(flow control)
applicationdata (variable length)
source port
Marina Papatriantafilou ndash Transport layer part2 3b-6
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-7
TCP seq numbers ACKs
sequence numbersndashldquonumberrdquo of first byte in
segmentrsquos dataacknowledgements
ndashseq of next byte expected from other side
ndashcumulative ACKsource port dest port
sequence number
acknowledgement number
checksum
rwnd
incoming segment to sender
A
sent ACKed
sent not-yet ACKed(ldquoin-flightrdquo)
usablebut not yet sent
not usable
window size N
sender sequence number space
source port dest port
sequence number
acknowledgement number
checksum
rwnd
outgoing segment from sender
Marina Papatriantafilou ndash Transport layer part2 3-8
TCP seq numbers ACKs
Usertypes
lsquoCrsquo
host ACKs receipt
of echoed lsquoCrsquo
host ACKs receipt of lsquoCrsquo echoes back lsquoCrsquo
Simple example scenarioBased on telnet msg exchange
Host BHost A
Seq=42 ACK=79 data = lsquoCrsquo
Seq=79 ACK=43 data = lsquoCrsquo
Seq=43 ACK=80
Always ack next in-order expected byte
Marina Papatriantafilou ndash Transport layer part2 3-9
TCP cumulative Ack - retransmission scenarios
Cumulative ACK (Premature) timeout
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=92 8bytes of data
tim
eout
ACK=120
Seq=100 20 bytes of data
ACK=120
SendBase=100
SendBase=120
SendBase=120
SendBase=92
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=120 15 bytes of data
tim
eout
Seq=100 20 bytes of data
ACK=120
Marina Papatriantafilou ndash Transport layer part2 3b-10
TCP ACK generation [RFC 1122 RFC 5681]
Event
in-order segment arrival no gapseverything else already ACKed
in-order segment arrival no gapsone delayed ACK pending
out-of-order segment arrivalhigher-than-expect seq gap detected
arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
immediately send singlecumulative ACK
send (duplicate) ACK indicating seq of next expected byte
immediate send ACK if segment startsat lower end of gap
Marina Papatriantafilou ndash Transport layer part2 3b-12
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 13
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
segment
segment
TCP round trip time timeout (1)
Q how to set TCP timeout value
longer than RTT but RTT varies
too short premature timeout unnecessary retransmissions
too long slow reaction to segment loss
Marina Papatriantafilou ndash Transport layer part2 3-14
EstimatedRTT = (1-)EstimatedRTT + SampleRTT
TCP round trip time timeout (2)
exponential weighted moving average influence of past sample decreases exponentially fast
typical value = 0125
DevRTT = (1-)DevRTT + |SampleRTT-EstimatedRTT|
(typically = 025)
TimeoutInterval = EstimatedRTT + 4DevRTT
estimated RTT ldquosafety marginrdquo
RTT gaiacsumassedu to fantasiaeurecomfr
100
150
200
250
300
350
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
RTT
(mill
isec
onds
)SampleRTT Estimated RTT
RTT (
mill
iseco
nds)
RTT gaiacsumassedu to fantasiaeurecomfr
sampleRTTEstimatedRTT
time (seconds)
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3b-6
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-7
TCP seq numbers ACKs
sequence numbersndashldquonumberrdquo of first byte in
segmentrsquos dataacknowledgements
ndashseq of next byte expected from other side
ndashcumulative ACKsource port dest port
sequence number
acknowledgement number
checksum
rwnd
incoming segment to sender
A
sent ACKed
sent not-yet ACKed(ldquoin-flightrdquo)
usablebut not yet sent
not usable
window size N
sender sequence number space
source port dest port
sequence number
acknowledgement number
checksum
rwnd
outgoing segment from sender
Marina Papatriantafilou ndash Transport layer part2 3-8
TCP seq numbers ACKs
Usertypes
lsquoCrsquo
host ACKs receipt
of echoed lsquoCrsquo
host ACKs receipt of lsquoCrsquo echoes back lsquoCrsquo
Simple example scenarioBased on telnet msg exchange
Host BHost A
Seq=42 ACK=79 data = lsquoCrsquo
Seq=79 ACK=43 data = lsquoCrsquo
Seq=43 ACK=80
Always ack next in-order expected byte
Marina Papatriantafilou ndash Transport layer part2 3-9
TCP cumulative Ack - retransmission scenarios
Cumulative ACK (Premature) timeout
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=92 8bytes of data
tim
eout
ACK=120
Seq=100 20 bytes of data
ACK=120
SendBase=100
SendBase=120
SendBase=120
SendBase=92
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=120 15 bytes of data
tim
eout
Seq=100 20 bytes of data
ACK=120
Marina Papatriantafilou ndash Transport layer part2 3b-10
TCP ACK generation [RFC 1122 RFC 5681]
Event
in-order segment arrival no gapseverything else already ACKed
in-order segment arrival no gapsone delayed ACK pending
out-of-order segment arrivalhigher-than-expect seq gap detected
arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
immediately send singlecumulative ACK
send (duplicate) ACK indicating seq of next expected byte
immediate send ACK if segment startsat lower end of gap
Marina Papatriantafilou ndash Transport layer part2 3b-12
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 13
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
segment
segment
TCP round trip time timeout (1)
Q how to set TCP timeout value
longer than RTT but RTT varies
too short premature timeout unnecessary retransmissions
too long slow reaction to segment loss
Marina Papatriantafilou ndash Transport layer part2 3-14
EstimatedRTT = (1-)EstimatedRTT + SampleRTT
TCP round trip time timeout (2)
exponential weighted moving average influence of past sample decreases exponentially fast
typical value = 0125
DevRTT = (1-)DevRTT + |SampleRTT-EstimatedRTT|
(typically = 025)
TimeoutInterval = EstimatedRTT + 4DevRTT
estimated RTT ldquosafety marginrdquo
RTT gaiacsumassedu to fantasiaeurecomfr
100
150
200
250
300
350
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
RTT
(mill
isec
onds
)SampleRTT Estimated RTT
RTT (
mill
iseco
nds)
RTT gaiacsumassedu to fantasiaeurecomfr
sampleRTTEstimatedRTT
time (seconds)
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-7
TCP seq numbers ACKs
sequence numbersndashldquonumberrdquo of first byte in
segmentrsquos dataacknowledgements
ndashseq of next byte expected from other side
ndashcumulative ACKsource port dest port
sequence number
acknowledgement number
checksum
rwnd
incoming segment to sender
A
sent ACKed
sent not-yet ACKed(ldquoin-flightrdquo)
usablebut not yet sent
not usable
window size N
sender sequence number space
source port dest port
sequence number
acknowledgement number
checksum
rwnd
outgoing segment from sender
Marina Papatriantafilou ndash Transport layer part2 3-8
TCP seq numbers ACKs
Usertypes
lsquoCrsquo
host ACKs receipt
of echoed lsquoCrsquo
host ACKs receipt of lsquoCrsquo echoes back lsquoCrsquo
Simple example scenarioBased on telnet msg exchange
Host BHost A
Seq=42 ACK=79 data = lsquoCrsquo
Seq=79 ACK=43 data = lsquoCrsquo
Seq=43 ACK=80
Always ack next in-order expected byte
Marina Papatriantafilou ndash Transport layer part2 3-9
TCP cumulative Ack - retransmission scenarios
Cumulative ACK (Premature) timeout
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=92 8bytes of data
tim
eout
ACK=120
Seq=100 20 bytes of data
ACK=120
SendBase=100
SendBase=120
SendBase=120
SendBase=92
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=120 15 bytes of data
tim
eout
Seq=100 20 bytes of data
ACK=120
Marina Papatriantafilou ndash Transport layer part2 3b-10
TCP ACK generation [RFC 1122 RFC 5681]
Event
in-order segment arrival no gapseverything else already ACKed
in-order segment arrival no gapsone delayed ACK pending
out-of-order segment arrivalhigher-than-expect seq gap detected
arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
immediately send singlecumulative ACK
send (duplicate) ACK indicating seq of next expected byte
immediate send ACK if segment startsat lower end of gap
Marina Papatriantafilou ndash Transport layer part2 3b-12
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 13
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
segment
segment
TCP round trip time timeout (1)
Q how to set TCP timeout value
longer than RTT but RTT varies
too short premature timeout unnecessary retransmissions
too long slow reaction to segment loss
Marina Papatriantafilou ndash Transport layer part2 3-14
EstimatedRTT = (1-)EstimatedRTT + SampleRTT
TCP round trip time timeout (2)
exponential weighted moving average influence of past sample decreases exponentially fast
typical value = 0125
DevRTT = (1-)DevRTT + |SampleRTT-EstimatedRTT|
(typically = 025)
TimeoutInterval = EstimatedRTT + 4DevRTT
estimated RTT ldquosafety marginrdquo
RTT gaiacsumassedu to fantasiaeurecomfr
100
150
200
250
300
350
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
RTT
(mill
isec
onds
)SampleRTT Estimated RTT
RTT (
mill
iseco
nds)
RTT gaiacsumassedu to fantasiaeurecomfr
sampleRTTEstimatedRTT
time (seconds)
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-8
TCP seq numbers ACKs
Usertypes
lsquoCrsquo
host ACKs receipt
of echoed lsquoCrsquo
host ACKs receipt of lsquoCrsquo echoes back lsquoCrsquo
Simple example scenarioBased on telnet msg exchange
Host BHost A
Seq=42 ACK=79 data = lsquoCrsquo
Seq=79 ACK=43 data = lsquoCrsquo
Seq=43 ACK=80
Always ack next in-order expected byte
Marina Papatriantafilou ndash Transport layer part2 3-9
TCP cumulative Ack - retransmission scenarios
Cumulative ACK (Premature) timeout
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=92 8bytes of data
tim
eout
ACK=120
Seq=100 20 bytes of data
ACK=120
SendBase=100
SendBase=120
SendBase=120
SendBase=92
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=120 15 bytes of data
tim
eout
Seq=100 20 bytes of data
ACK=120
Marina Papatriantafilou ndash Transport layer part2 3b-10
TCP ACK generation [RFC 1122 RFC 5681]
Event
in-order segment arrival no gapseverything else already ACKed
in-order segment arrival no gapsone delayed ACK pending
out-of-order segment arrivalhigher-than-expect seq gap detected
arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
immediately send singlecumulative ACK
send (duplicate) ACK indicating seq of next expected byte
immediate send ACK if segment startsat lower end of gap
Marina Papatriantafilou ndash Transport layer part2 3b-12
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 13
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
segment
segment
TCP round trip time timeout (1)
Q how to set TCP timeout value
longer than RTT but RTT varies
too short premature timeout unnecessary retransmissions
too long slow reaction to segment loss
Marina Papatriantafilou ndash Transport layer part2 3-14
EstimatedRTT = (1-)EstimatedRTT + SampleRTT
TCP round trip time timeout (2)
exponential weighted moving average influence of past sample decreases exponentially fast
typical value = 0125
DevRTT = (1-)DevRTT + |SampleRTT-EstimatedRTT|
(typically = 025)
TimeoutInterval = EstimatedRTT + 4DevRTT
estimated RTT ldquosafety marginrdquo
RTT gaiacsumassedu to fantasiaeurecomfr
100
150
200
250
300
350
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
RTT
(mill
isec
onds
)SampleRTT Estimated RTT
RTT (
mill
iseco
nds)
RTT gaiacsumassedu to fantasiaeurecomfr
sampleRTTEstimatedRTT
time (seconds)
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-9
TCP cumulative Ack - retransmission scenarios
Cumulative ACK (Premature) timeout
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=92 8bytes of data
tim
eout
ACK=120
Seq=100 20 bytes of data
ACK=120
SendBase=100
SendBase=120
SendBase=120
SendBase=92
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
Seq=120 15 bytes of data
tim
eout
Seq=100 20 bytes of data
ACK=120
Marina Papatriantafilou ndash Transport layer part2 3b-10
TCP ACK generation [RFC 1122 RFC 5681]
Event
in-order segment arrival no gapseverything else already ACKed
in-order segment arrival no gapsone delayed ACK pending
out-of-order segment arrivalhigher-than-expect seq gap detected
arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
immediately send singlecumulative ACK
send (duplicate) ACK indicating seq of next expected byte
immediate send ACK if segment startsat lower end of gap
Marina Papatriantafilou ndash Transport layer part2 3b-12
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 13
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
segment
segment
TCP round trip time timeout (1)
Q how to set TCP timeout value
longer than RTT but RTT varies
too short premature timeout unnecessary retransmissions
too long slow reaction to segment loss
Marina Papatriantafilou ndash Transport layer part2 3-14
EstimatedRTT = (1-)EstimatedRTT + SampleRTT
TCP round trip time timeout (2)
exponential weighted moving average influence of past sample decreases exponentially fast
typical value = 0125
DevRTT = (1-)DevRTT + |SampleRTT-EstimatedRTT|
(typically = 025)
TimeoutInterval = EstimatedRTT + 4DevRTT
estimated RTT ldquosafety marginrdquo
RTT gaiacsumassedu to fantasiaeurecomfr
100
150
200
250
300
350
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
RTT
(mill
isec
onds
)SampleRTT Estimated RTT
RTT (
mill
iseco
nds)
RTT gaiacsumassedu to fantasiaeurecomfr
sampleRTTEstimatedRTT
time (seconds)
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3b-10
TCP ACK generation [RFC 1122 RFC 5681]
Event
in-order segment arrival no gapseverything else already ACKed
in-order segment arrival no gapsone delayed ACK pending
out-of-order segment arrivalhigher-than-expect seq gap detected
arrival of segment that partially or completely fills gap
TCP Receiver action
Delayed ACK Wait up to 500msfor next segment If no next segmentsend ACK
immediately send singlecumulative ACK
send (duplicate) ACK indicating seq of next expected byte
immediate send ACK if segment startsat lower end of gap
Marina Papatriantafilou ndash Transport layer part2 3b-12
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 13
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
segment
segment
TCP round trip time timeout (1)
Q how to set TCP timeout value
longer than RTT but RTT varies
too short premature timeout unnecessary retransmissions
too long slow reaction to segment loss
Marina Papatriantafilou ndash Transport layer part2 3-14
EstimatedRTT = (1-)EstimatedRTT + SampleRTT
TCP round trip time timeout (2)
exponential weighted moving average influence of past sample decreases exponentially fast
typical value = 0125
DevRTT = (1-)DevRTT + |SampleRTT-EstimatedRTT|
(typically = 025)
TimeoutInterval = EstimatedRTT + 4DevRTT
estimated RTT ldquosafety marginrdquo
RTT gaiacsumassedu to fantasiaeurecomfr
100
150
200
250
300
350
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
RTT
(mill
isec
onds
)SampleRTT Estimated RTT
RTT (
mill
iseco
nds)
RTT gaiacsumassedu to fantasiaeurecomfr
sampleRTTEstimatedRTT
time (seconds)
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3b-12
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 13
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
segment
segment
TCP round trip time timeout (1)
Q how to set TCP timeout value
longer than RTT but RTT varies
too short premature timeout unnecessary retransmissions
too long slow reaction to segment loss
Marina Papatriantafilou ndash Transport layer part2 3-14
EstimatedRTT = (1-)EstimatedRTT + SampleRTT
TCP round trip time timeout (2)
exponential weighted moving average influence of past sample decreases exponentially fast
typical value = 0125
DevRTT = (1-)DevRTT + |SampleRTT-EstimatedRTT|
(typically = 025)
TimeoutInterval = EstimatedRTT + 4DevRTT
estimated RTT ldquosafety marginrdquo
RTT gaiacsumassedu to fantasiaeurecomfr
100
150
200
250
300
350
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
RTT
(mill
isec
onds
)SampleRTT Estimated RTT
RTT (
mill
iseco
nds)
RTT gaiacsumassedu to fantasiaeurecomfr
sampleRTTEstimatedRTT
time (seconds)
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 13
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
segment
segment
TCP round trip time timeout (1)
Q how to set TCP timeout value
longer than RTT but RTT varies
too short premature timeout unnecessary retransmissions
too long slow reaction to segment loss
Marina Papatriantafilou ndash Transport layer part2 3-14
EstimatedRTT = (1-)EstimatedRTT + SampleRTT
TCP round trip time timeout (2)
exponential weighted moving average influence of past sample decreases exponentially fast
typical value = 0125
DevRTT = (1-)DevRTT + |SampleRTT-EstimatedRTT|
(typically = 025)
TimeoutInterval = EstimatedRTT + 4DevRTT
estimated RTT ldquosafety marginrdquo
RTT gaiacsumassedu to fantasiaeurecomfr
100
150
200
250
300
350
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
RTT
(mill
isec
onds
)SampleRTT Estimated RTT
RTT (
mill
iseco
nds)
RTT gaiacsumassedu to fantasiaeurecomfr
sampleRTTEstimatedRTT
time (seconds)
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-14
EstimatedRTT = (1-)EstimatedRTT + SampleRTT
TCP round trip time timeout (2)
exponential weighted moving average influence of past sample decreases exponentially fast
typical value = 0125
DevRTT = (1-)DevRTT + |SampleRTT-EstimatedRTT|
(typically = 025)
TimeoutInterval = EstimatedRTT + 4DevRTT
estimated RTT ldquosafety marginrdquo
RTT gaiacsumassedu to fantasiaeurecomfr
100
150
200
250
300
350
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
RTT
(mill
isec
onds
)SampleRTT Estimated RTT
RTT (
mill
iseco
nds)
RTT gaiacsumassedu to fantasiaeurecomfr
sampleRTTEstimatedRTT
time (seconds)
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3b-15
TCP fast retransmit (RFC 5681) time-out period often
relatively long long delay before resending lost
packet
IMPROVEMENT detect lost segments via duplicate ACKs
if sender receives 3 duplicate ACKs for same data
bull resend unacked segment with smallest seq
likely that unacked segment lost so donrsquot wait for timeout
TCP fast retransmit
Implicit NAKQ Why need at least 3
X
Host BHost A
Seq=92 8 bytes of data
ACK=100
tim
eout
ACK=100
ACK=100
Seq=100 20 bytes of data
Seq=100 20 bytes of data
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3b-16
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-17
Connection Managementbefore exchanging data senderreceiver ldquohandshakerdquobull agree to establish connection (each knowing the other willing
to establish connection)bull 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()
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-18
Setting up a connection TCP 3-way handshake
SYN=1 Seq=x
choose init seq num xsend TCP SYN msg
ESTAB
SYN=1 Seq=yACK=1 ACKnum=x+1
choose init seq num ysend TCP SYNACKmsg acking SYNReserve buffer
ACK=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 server state
LISTEN
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-19
FIN_WAIT_2
CLOSE_WAIT
FIN=1 seq=y
ACK=1 ACKnum=y+1
ACK=1 ACKnum=x+1 wait for server
close
can stillsend data
can no longersend data
LAST_ACK
CLOSED
TIME_WAIT
timed wait (typically 30s)
CLOSED
TCP closing a connection
FIN_WAIT_1 FIN=1 seq=xcan no longersend but can receive data
clientSocketclose()
client state server state
ESTABESTAB
simultaneous FINscan be handled
RST alternative way to close connection immediately when error occurs
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2
Is TCP stateful or stateless
21
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3b-22
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-23
TCP flow controlapplicationprocess
TCP socketreceiver buffers
TCPcode
IPcode
application
OS
receiver protocol stack
applicationmight remove data from
TCP socket buffers hellip
hellip slower than TCP is delivering
(ie slower than sender is sending)
from sender
receiver controls sender so sender wonrsquot overflow receiverrsquos buffer by transmitting too much too fast
flow control
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-24
TCP flow control
buffered data
free buffer spacerwnd
RcvBuffer
TCP segment payloads
to application process
bull receiver ldquoadvertisesrdquo free buffer space by including rwnd value in TCP header of receiver-to-sender segmentsndash RcvBuffer size set via
socket options (typical default is 4096 bytes)
ndash many operating systems autoadjust RcvBuffer
bull sender limits amount of unacked (ldquoin-flightrdquo) data to receiverrsquos rwnd value
bull guarantees receive buffer will not overflow
receiver-side buffering
3-24
source port dest port
sequence numberacknowledgement number
checksum
rwndATo sender
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3b-25
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2
congestionbull informally ldquotoo many sources sending too much data
too fast for network to handlerdquobull manifestations
ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)
Principles of congestion control
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 27
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-28
Causescosts of congestion scenario 1 (unrealistic)
two senders two receivers average rate of data is lin
one router infinite buffers output link capacity R (no retransmission in the
ldquopicturerdquo yet)
maximum per-connection throughput R2
unlimited shared output link buffers
Host A
original data lin
Host B
throughput lout
R2
R2
l out
lin R2d
ela
ylin
large delays as arrival rate lin approaches capacity
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-29
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
(application-level throughput) unneeded retransmissions links carry multiple
copies of pkt
R2lin
Causescosts of congestion scenario 2 Realistic buffers
bounded =gt duplicates
packets can be lost dropped at router due to full buffers
sender times out sending two copies
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-30
another cost of congestion when packets dropped any ldquoupstream
transmission capacity used for that packet was wasted
Causescosts of congestion scenario 3
C2
l ou
t
linrsquo(incl Retransmisions)
Consider 4 streams
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-31
Approaches towards congestion control
two broad approaches towards congestion control
end-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 systems eg a single bit indicating
congestion explicit rate for sender
to send at
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3b-32
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-33
TCP congestion control additive increase multiplicative decrease end-end control (no network assistance) sender limits transmissionHow does sender perceive congestion
loss = timeout or 3 duplicate acks TCP sender reduces rate (Congestion Window) then
Additive Increase increase cwnd by 1 MSS every RTT until loss detected Multiplicative Decrease cut cwnd in half after loss To start with slow start
AIMD saw toothbehavior probing
for bandwidth
cwnd
TC
P s
end
er
cong
estio
n w
indo
w s
ize
additively increase window size helliphellip until loss occurs (then cut window in half)
time
rate ~~cwnd
RTTbytessec
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-34
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
RT
T
Host B
time
two segments
four segments
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-35
Q when should the exponential increase switch to linear
A when cwnd gets to 12 of its value before timeout
Implementation variable ssthresh (slow start
threshold) on loss event ssthresh is set to
12 of cwnd just before loss event
TCP cwnd from exp to linear growth + reacting to loss
Reno loss indicated by timeout or 3 duplicate ACKscwnd is cut in half then grows linearly
Non-optimized loss indicated by timeoutcwnd set to 1 MSS window then grows as in slow start to threshold then grows linearly
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-38
fairness goal if K TCP sessions share same bottleneck link of bandwidth R each should have average rate of RK
TCP connection 1
bottleneckroutercapacity R
TCP Fairness
TCP connection 2
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2
How many windows does a TCPrsquos sender maintain
39
Need for flow control Need for congestion control
Fig A TanenbaumComputer Networks
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-40
TCP combined flow-ctrl congestion ctrl windows
sender limits transmission
cwnd is dynamic function of perceived network congestion rwnd dymanically limited by receiverrsquos buffer space
TCP sending rate roughly send min cwnd
rwnd bytes wait RTT for ACKS then send more bytes
Mincwnd rwnd
last byteACKed sent not-
yet ACKed(ldquoin-flightrdquo)
last byte sent
LastByteSent-LastByteAcked
lt Mincwnd rwnd
sender sequence number space
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3b-41
Roadmap Transport Layer
bull transport layer servicesbull multiplexingdemultiplexingbull connectionless transport UDPbull principles of reliable data transferbull connection-oriented transport TCP
ndash reliable transferbull Acknowledgements bull Retransmissions bull Connection managementbull Flow control and buffer space
ndash Congestion controlbull Principlesbull TCP congestion control
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-42
Chapter 3 summary
principles behind transport layer services Addressing reliable data transfer flow control congestion control
instantiation implementation in the Internet UDP TCP
nextbull leaving the network
ldquoedgerdquo (application transport layers)
bull into the network ldquocorerdquo
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2
Some review questions on this part
bull Describe TCPrsquos flow controlbull Why does TCp do fast retransmit upon a 3rd ack and not a 2ndbull Describe TCPrsquos congestion control principle method for detection
of congestion reactionbull Can a TCPrsquos session sending rate increase indefinitelybull Why does TCP need connection managementbull Why does TCP use handshaking in the start and the end of
connectionbull Can an application have reliable data transfer if it uses UDP How or
why not
3b-43
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2
Reading instructions chapter 3
bull KuroseRoss book
bull Other resources (further study)ndash Eddie Kohler Mark Handley and Sally Floyd 2006 Designing DCCP congestion
control without reliability SIGCOMM Comput Commun Rev 36 4 (August 2006) 27-38 DOI=10114511516591159918 httpdoiacmorg10114511516591159918
ndash httpresearchmicrosoftcomappsvideodefaultaspxid=104005
ndash Exercisethroughput analysis TCP in following slides
Careful Quick
31 32 34-37 33
3-44
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2
Extra slides for further study
3 Transport Layer 3b-45
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-46
TCP throughput
bull avg TCP throughput as function of window size RTTndash ignore slow start assume always data to send
bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg trhoughput is 34W per RTT
W
W2
avg TCP trhoughput = 34
WRTTbytessec
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 Transport Layer
3-47
TCP Futures TCP over ldquolong fat pipesrdquo
bull example 1500 byte segments 100ms RTT want 10 Gbps throughput
bull requires W = 83333 in-flight segmentsbull 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
bull new versions of TCP for high-speed
TCP throughput = 122 MSSRTT L
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-48
Why is TCP fair
two competing sessions additive increase gives slope of 1 as throughout increases multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Con
nect
ion
2 th
roug
h pu t
congestion avoidance additive increaseloss decrease window by factor of 2
congestion avoidance additive increaseloss decrease window by factor of 2
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3-49
Fairness (more)
Fairness and UDPmultimedia apps often
do not use TCP do not want rate
throttled by congestion control
instead use UDP send audiovideo at
constant rate tolerate packet loss
Fairness parallel TCP connections
application can open multiple parallel connections between two hosts
web browsers do this eg link of rate R with 9
existing connections new app asks for 1 TCP gets rate
R10 new app asks for 11 TCPs gets R2
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-50
TCP delay modeling (slow start ndash related)
Q How long does it take to receive an object from a Web server after sending a request
bull TCP connection establishmentbull data transfer delay
Notation assumptionsbull Assume one link between client
and server of rate Rbull Assume fixed congestion
window W segmentsbull S MSS (bits)bull O object size (bits)bull no retransmissions (no loss no
corruption)bull Receiver has unbounded buffer
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-51
TCP delay Modeling simplified fixed window
Case 1 WSR gt RTT + SR ACK for first segment in window returns before windowrsquos worth of data nsentdelay = 2RTT + OR
Case 2 WSR lt RTT + SR wait for ACK after sending windowrsquos worth of data sentdelay = 2RTT + OR+ (K-1)[SR + RTT - WSR]
K= OWS
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-52
TCP Delay Modeling Slow Start
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Examplebull OS = 15 segmentsbull K = 4 windowsbull Q = 2bull Server idles P = minK-1Q = 2 times
Delay componentsbull 2 RTT for connection estab and requestbull OR to transmit objectbull time server idles due to slow start
Server idles P = minK-1Q times
where - Q = times server stalls until cong window is larger than a ldquofull-utilizationrdquo window (if the object were of unbounded size)
- K = (incremental-sized) congestion-windows that ldquocoverrdquo the object
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3 Transport Layer 3b-53
TCP Delay Modeling (slow start - cont)
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
idleTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2delay
1
1
1
th window after the timeidle 2 1 kR
SRTT
R
S k
ementacknowledg receivesserver until
segment send tostartsserver whenfrom time RTTR
S
window kth the transmit totime2 1
R
Sk
RTT
initia te TCPconnection
requestobject
first w indow= S R
second w indow= 2S R
third w indow= 4S R
fourth w indow= 8S R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-
Marina Papatriantafilou ndash Transport layer part2 3b-54
TCP Delay Modeling
)1(log
)1(logmin
12min
222min
222min
2
2
110
110
S
OS
Okk
S
Ok
SOk
OSSSkK
k
k
k
Calculation of Q number of idles for infinite-size objectis similar
Recall K = number of windows that cover object
How do we calculate K
- Course on Computer Communication and Networks Lecture 5 Chap
- Roadmap Transport Layer
- TCP Overview RFCs 79311221323 2018 5681
- TCP segment structure
- Roadmap Transport Layer (2)
- TCP seq numbers ACKs
- TCP seq numbers ACKs (2)
- TCP cumulative Ack - retransmission scenarios
- TCP ACK generation [RFC 1122 RFC 5681]
- Roadmap Transport Layer (3)
- TCP round trip time timeout (1)
- TCP round trip time timeout (2)
- TCP fast retransmit (RFC 5681)
- Roadmap Transport Layer (4)
- Connection Management
- Setting up a connection TCP 3-way handshake
- TCP closing a connection
- Is TCP stateful or stateless
- Roadmap Transport Layer (5)
- TCP flow control
- TCP flow control (2)
- Roadmap Transport Layer (6)
- Principles of congestion control
- Slide 27
- Causescosts of congestion scenario 1 (unrealistic)
- Causescosts of congestion scenario 2
- Causescosts of congestion scenario 3
- Approaches towards congestion control
- Roadmap Transport Layer (7)
- TCP congestion control additive increase multiplicative decre
- TCP Slow Start
- TCP cwnd from exp to linear growth + reacting to loss
- TCP Fairness
- How many windows does a TCPrsquos sender maintain
- TCP combined flow-ctrl congestion ctrl windows
- Roadmap Transport Layer (8)
- Chapter 3 summary
- Some review questions on this part
- Reading instructions chapter 3
- Extra slides for further study
- TCP throughput
- TCP Futures TCP over ldquolong fat pipesrdquo
- Why is TCP fair
- Fairness (more)
- TCP delay modeling (slow start ndash related)
- TCP delay Modeling simplified fixed window
- TCP Delay Modeling Slow Start
- TCP Delay Modeling (slow start - cont)
- TCP Delay Modeling
-