SlideShare a Scribd company logo
1 of 71
Transport Layer 3-1
Chapter 3
Transport Layer
Computer Networking:
A Top Down Approach
Featuring the Internet,
2nd edition.
Jim Kurose, Keith Ross
Addison-Wesley, July
2002.
A note on the use of these ppt slides:
We’re making these slides freely available to all (faculty, students, readers).
They’re in powerpoint form so you can add, modify, and delete slides
(including this one) and slide content to suit your needs. They obviously
represent a lot of work on our part. In return for use, we only ask the
following:
īą If you use these slides (e.g., in a class) in substantially unaltered form,
that you mention their source (after all, we’d like people to use our book!)
īą If you post any slides in substantially unaltered form on a www site, that
you note that they are adapted from (or perhaps identical to) our slides, and
note our copyright of this material.
Thanks and enjoy! JFK/KWR
All material copyright 1996-2002
J.F Kurose and K.W. Ross, All Rights Reserved
Transport Layer 3-2
Chapter 3 outline
ī˛ 3.1 Transport-layer
services
ī˛ 3.2 Multiplexing and
demultiplexing
ī˛ 3.3 Connectionless
transport: UDP
ī˛ 3.4 Principles of
reliable data transfer
ī˛ 3.5 Connection-oriented
transport: TCP
ī­ segment structure
ī­ reliable data transfer
ī­ flow control
ī­ connection management
ī˛ 3.6 Principles of
congestion control
ī˛ 3.7 TCP congestion
control
Transport Layer 3-3
TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581
ī˛ full duplex data:
ī­ bi-directional data flow
in same connection
ī­ MSS: maximum segment
size
ī˛ connection-oriented:
ī­ handshaking (exchange
of control msgs) init’s
sender, receiver state
before data exchange
ī˛ flow controlled:
ī­ sender will not
overwhelm receiver
ī˛ point-to-point:
ī­ one sender, one receiver
ī˛ reliable, in-order byte
steam:
ī­ no “message boundaries”
ī˛ pipelined:
ī­ TCP congestion and flow
control set window size
ī˛ send & receive buffers
socket
door
TCP
send buffer
TCP
receive buffer
socket
door
segment
application
writes data
application
reads data
Transport Layer 3-4
TCP segment structure
source port # dest port #
32 bits
application
data
(variable length)
sequence number
acknowledgement number
Receive window
Urg data pnter
checksum
F
S
R
P
A
U
head
len
not
used
Options (variable length)
URG: urgent data
(generally not used)
ACK: ACK #
valid
PSH: push data now
(generally not used)
RST, SYN, FIN:
connection estab
(setup, teardown
commands)
# bytes
rcvr willing
to accept
counting
by bytes
of data
(not segments!)
Internet
checksum
(as in UDP)
Transport Layer 3-5
TCP seq. #’s and ACKs
Seq. #’s:
ī­ byte stream
“number” of first
byte in segment’s
data
ACKs:
ī­ seq # of next byte
expected from
other side
ī­ cumulative ACK
Q: how receiver handles
out-of-order segments
ī­ A: TCP spec doesn’t
say, - up to
implementor
Host A Host B
User
types
‘C’
host ACKs
receipt
of echoed
‘C’
host ACKs
receipt of
‘C’, echoes
back ‘C’
time
simple telnet scenario
Transport Layer 3-6
TCP Round Trip Time and Timeout
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, causing
low TCP throughput.
Q: how to estimate RTT?
ī˛ SampleRTT: measured time from
segment transmission until ACK
receipt
ī­ ignore retransmissions
ī˛ SampleRTT will vary, want
estimated RTT “smoother”
ī­ average several recent
measurements, not just
current SampleRTT
Transport Layer 3-7
TCP Round Trip Time and Timeout
EstimatedRTT = (1- īĄ)*EstimatedRTT + īĄ*SampleRTT
ī˛ Exponential weighted moving average
ī˛ influence of past sample decreases exponentially fast
ī˛ typical value: īĄ = 0.125
Transport Layer 3-8
Example RTT estimation:
RTT: gaia.cs.umass.edu to fantasia.eurecom.fr
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
(milliseconds)
SampleRTT Estimated RTT
Transport Layer 3-9
TCP Round Trip Time and Timeout
Setting the timeout
ī˛ EstimtedRTT plus “safety margin”
ī­ large variation in EstimatedRTT -> larger safety margin
ī˛ first estimate of how much SampleRTT deviates from
EstimatedRTT:
TimeoutInterval = EstimatedRTT + 4*DevRTT
DevRTT = (1-īĸ)*DevRTT +
īĸ*|SampleRTT-EstimatedRTT|
(typically, īĸ = 0.25)
Then set timeout interval:
Transport Layer 3-10
Example RTT estimation:
RTT Estimation and Timeout
0
50
100
150
200
250
300
350
400
450
500
1 14 27 40 53 66 79 92 105
sample #
RTT
(ms)
RTT sample
RTT est
Dev est
Timeout
Transport Layer 3-11
Chapter 3 outline
ī˛ 3.1 Transport-layer
services
ī˛ 3.2 Multiplexing and
demultiplexing
ī˛ 3.3 Connectionless
transport: UDP
ī˛ 3.4 Principles of
reliable data transfer
ī˛ 3.5 Connection-oriented
transport: TCP
ī­ segment structure
ī­ reliable data transfer
ī­ flow control
ī­ connection management
ī˛ 3.6 Principles of
congestion control
ī˛ 3.7 TCP congestion
control
Transport Layer 3-12
TCP reliable data transfer
ī˛ TCP creates rdt
service on top of IP’s
unreliable service
ī˛ Pipelined segments
ī˛ Cumulative acks
ī˛ TCP uses single
retransmission timer
ī˛ Retransmissions are
triggered by:
ī­ timeout events
ī­ duplicate acks
ī˛ Initially consider
simplified TCP sender:
ī­ ignore duplicate acks
ī­ ignore flow control,
congestion control
Transport Layer 3-13
TCP sender events:
data rcvd from app:
ī˛ Create segment with
seq #
ī˛ seq # is byte-stream
number of first data
byte in segment
ī˛ start timer if not
already running (think
of timer as for oldest
unacked segment)
ī˛ expiration interval:
TimeOutInterval
timeout:
ī˛ retransmit segment
that caused timeout
ī˛ restart timer
Ack rcvd:
ī˛ If acknowledges
previously unacked
segments
ī­ update what is known to
be acked
ī­ start timer if there are
outstanding segments
Transport Layer 3-14
TCP
sender
(simplified)
NextSeqNum = InitialSeqNum
SendBase = InitialSeqNum
loop (forever) {
switch(event)
event: data received from application above
create TCP segment with sequence number NextSeqNum
if (timer currently not running)
start timer
pass segment to IP
NextSeqNum = NextSeqNum + length(data)
event: timer timeout
retransmit not-yet-acknowledged segment with
smallest sequence number
start timer
event: ACK received, with ACK field value of y
if (y > SendBase) {
SendBase = y
if (there are currently not-yet-acknowledged segments)
start timer
}
} /* end of loop forever */
Comment:
â€ĸ SendBase-1: last
cumulatively
ack’ed byte
Example:
â€ĸ SendBase-1 = 71;
y= 73, so the rcvr
wants 73+ ;
y > SendBase, so
that new data is
acked
Transport Layer 3-15
TCP: retransmission scenarios
Host A
time
premature timeout
Host B
Seq=92
timeout
Host A
loss
timeout
lost ACK scenario
Host B
X
time
Seq=92
timeout
SendBase
= 100
SendBase
= 120
SendBase
= 120
Sendbase
= 100
Start timing
Packet (100)
Transport Layer 3-16
TCP retransmission scenarios (more)
Host A
loss
timeout
Cumulative ACK scenario
Host B
X
time
SendBase
= 120
Transport Layer 3-17
TCP ACK generation [RFC 1122, RFC 2581]
Event at Receiver
Arrival of in-order segment with
expected seq #. All data up to
expected seq # already ACKed
Arrival of in-order segment with
expected seq #. One other
segment has ACK pending
Arrival of out-of-order segment
higher-than-expect seq. # .
Gap detected
Arrival of segment that
partially or completely fills gap
TCP Receiver action
Delayed ACK. Wait up to 500ms
for next segment. If no next segment,
send ACK
Immediately send single cumulative
ACK, ACKing both in-order segments
Immediately send duplicate ACK,
indicating seq. # of next expected byte
Immediate send ACK, update next
Expected byte
Transport Layer 3-18
Fast Retransmit
ī˛ Time-out period often
relatively long:
ī­ long delay before
resending lost packet
ī˛ Detect lost segments
via duplicate ACKs.
ī­ Sender often sends
many segments back-to-
back
ī­ If segment is lost,
there will likely be many
duplicate ACKs.
ī˛ If sender receives 3
ACKs for the same
data, it supposes that
segment after ACKed
data was lost:
ī­ fast retransmit: resend
segment before timer
expires
Transport Layer 3-19
event: ACK received, with ACK field value of y
if (y > SendBase) {
SendBase = y
if (there are currently not-yet-acknowledged segments)
start timer
}
else {
increment count of dup ACKs received for y
if (count of dup ACKs received for y = 3) {
resend segment with sequence number y
}
Fast retransmit algorithm:
a duplicate ACK for
already ACKed segment
fast retransmit
Transport Layer 3-20
Doubling Timeout Interval
ī˛ Many TCP implementations double the next
TimeoutInterval after a timer
expiration.
ī˛ This typically happens at
ī­ beginning of a connection
ī­ when sending the first packet after a long quiet
period
ī˛ This is one form of congestion control
ī­ Timer expiration due to packet loss
ī­ Doubling TimeoutInterval leads to
exponential slowing down of transmission.
Transport Layer 3-21
Selective Acknowledgement
(SACK)
ī˛ TCP resembles Go-Back-N but
ī­ But, it retransmits only one
packet at a time, not the
subsequent packets
ī˛ TCP has an option of Selective
Acknowledgement
ī­ Uses the optional fields in
the TCP header
ī­ Receiver indicates
consecutive blocks of
received, but out-of-order,
data
ī­ With this option, TCP looks
like Selective Repeat
+--------+--------+--------+--------+
| Left Edge of 1st Block |
+--------+--------+--------+--------+
| Right Edge of 1st Block |
+--------+--------+--------+--------+
| |
/ . . . /
| |
+--------+--------+--------+--------+
| Left Edge of nth Block |
+--------+--------+--------+--------+
| Right Edge of nth Block |
+--------+--------+--------+--------+
Transport Layer 3-22
Chapter 3 outline
ī˛ 3.1 Transport-layer
services
ī˛ 3.2 Multiplexing and
demultiplexing
ī˛ 3.3 Connectionless
transport: UDP
ī˛ 3.4 Principles of
reliable data transfer
ī˛ 3.5 Connection-oriented
transport: TCP
ī­ segment structure
ī­ reliable data transfer
ī­ flow control
ī­ connection management
ī˛ 3.6 Principles of
congestion control
ī˛ 3.7 TCP congestion
control
Transport Layer 3-23
TCP Flow Control
ī˛ receive side of TCP
connection has a
receive buffer:
ī˛ speed-matching
service: matching the
send rate to the
receiving app’s drain
rate
ī˛ app process may be
slow at reading from
buffer
sender won’t overflow
receiver’s buffer by
transmitting too much,
too fast
flow control
Transport Layer 3-24
TCP Flow control: how it works
(Suppose TCP receiver
discards out-of-order
segments)
ī˛ spare room in buffer
= RcvWindow
= RcvBuffer-[LastByteRcvd -
LastByteRead]
ī˛ Rcvr advertises spare
room by including value
of RcvWindow in
segments
ī˛ Sender limits unACKed
data to RcvWindow
ī­ guarantees receive
buffer doesn’t overflow
Transport Layer 3-25
Chapter 3 outline
ī˛ 3.1 Transport-layer
services
ī˛ 3.2 Multiplexing and
demultiplexing
ī˛ 3.3 Connectionless
transport: UDP
ī˛ 3.4 Principles of
reliable data transfer
ī˛ 3.5 Connection-oriented
transport: TCP
ī­ segment structure
ī­ reliable data transfer
ī­ flow control
ī­ connection management
ī˛ 3.6 Principles of
congestion control
ī˛ 3.7 TCP congestion
control
Transport Layer 3-26
TCP Connection Management
Recall: TCP sender, receiver
establish “connection”
before exchanging data
segments
ī˛ initialize TCP variables:
ī­ seq. #s
ī­ buffers, flow control
info (e.g. RcvWindow)
ī˛ client: connection initiator
Socket clientSocket = new
Socket("hostname","port
number");
ī˛ server: contacted by client
Socket connectionSocket =
welcomeSocket.accept();
Three way handshake:
Step 1: client host sends TCP
SYN segment to server
ī­ specifies initial seq #
ī­ no data
Step 2: server host receives
SYN, replies with SYNACK
segment
ī­ server allocates buffers
ī­ specifies server initial
seq. #
Step 3: client receives SYNACK,
replies with ACK segment,
which may contain data
Transport Layer 3-27
TCP Connection Management (cont.)
Closing a connection:
client closes socket:
clientSocket.close();
Step 1: client end system
sends TCP FIN control
segment to server
Step 2: server receives
FIN, replies with ACK.
Closes connection, sends
FIN.
client server
close
close
closed
timed
wait
Transport Layer 3-28
TCP Connection Management (cont.)
Step 3: client receives FIN,
replies with ACK.
ī­ Enters “timed wait” -
will respond with ACK
to received FINs
Step 4: server, receives
ACK. Connection closed.
Note: with small
modification, can handle
simultaneous FINs.
client server
closing
closing
closed
timed
wait closed
Transport Layer 3-29
TCP Connection Management (cont)
TCP client
lifecycle
TCP server
lifecycle
For full FSM, see
handout.
Transport Layer 3-30
Chapter 3 outline
ī˛ 3.1 Transport-layer
services
ī˛ 3.2 Multiplexing and
demultiplexing
ī˛ 3.3 Connectionless
transport: UDP
ī˛ 3.4 Principles of
reliable data transfer
ī˛ 3.5 Connection-oriented
transport: TCP
ī­ segment structure
ī­ reliable data transfer
ī­ flow control
ī­ connection management
ī˛ 3.6 Principles of
congestion control
ī˛ 3.7 TCP congestion
control
Transport Layer 3-31
Principles of Congestion Control
Congestion:
ī˛ informally: “too many sources sending too much
data too fast for network to handle”
ī˛ different from flow control!
ī˛ manifestations:
ī­ lost packets (buffer overflow at routers)
ī­ long delays (queueing in router buffers)
ī˛ a top-10 problem!
Transport Layer 3-32
Causes/costs of congestion: scenario 1
ī˛ two senders, two
receivers
ī˛ one router,
infinite buffers
ī˛ no retransmission
ī˛ large delays
when congested
ī˛ maximum
achievable
throughput
unlimited shared
output link buffers
Host A
lin : original data
Host B
lout
Transport Layer 3-33
Causes/costs of congestion: scenario 2
ī˛ one router, finite buffers
ī˛ sender retransmission of lost packet
finite shared output
link buffers
Host A lin : original
data
Host B
lout
l'in : original data, plus
retransmitted data
Transport Layer 3-34
Causes/costs of congestion: scenario 2
ī˛ always: (goodput)
ī˛ “perfect” retransmission only when loss:
ī˛ retransmission of delayed (not lost) packet makes larger
(than perfect case) for same
l
in
lout
=
l
in
lout
>
l
in
lout
“costs” of congestion:
ī˛ more work (retrans) for given “goodput”
ī˛ unneeded retransmissions: link carries multiple copies of pkt
Transport Layer 3-35
Causes/costs of congestion: scenario 3
ī˛ four senders
ī˛ multihop paths
ī˛ timeout/retransmit
l
in
Q: what happens as
and increase ?
l
in
finite shared output
link buffers
Host A
lin : original data
Host D
lout
l'in : original data, plus
retransmitted data
Host B
Host C
R1
R2
Transport Layer 3-36
Causes/costs of congestion: scenario 3
Another “cost” of congestion:
ī˛ when packet dropped, any “upstream transmission
capacity used for that packet was wasted!
H
o
s
t
A
H
o
s
t
B
l
o
u
t
Transport Layer 3-37
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
ī­ single bit indicating
congestion (SNA,
DECbit, TCP/IP ECN,
ATM)
ī­ explicit rate sender
should send at
Two broad approaches towards congestion control:
Transport Layer 3-38
Case study: ATM ABR congestion control
ABR: available bit rate:
ī˛ “elastic service”
ī˛ if sender’s path
“underloaded”:
ī­ sender should use
available bandwidth
ī˛ if sender’s path
congested:
ī­ sender throttled to
minimum guaranteed
rate
RM (resource management)
cells:
ī˛ sent by sender, interspersed
with data cells
ī˛ bits in RM cell set by switches
(“network-assisted”)
ī­ NI bit: no increase in rate
(mild congestion)
ī­ CI bit: congestion
indication
ī˛ RM cells returned to sender by
receiver, with bits intact
Transport Layer 3-39
Case study: ATM ABR congestion control
ī˛ two-byte ER (explicit rate) field in RM cell
ī­ congested switch may lower ER value in cell
ī­ sender’ send rate thus minimum supportable rate on path
ī˛ EFCI bit in data cells: set to 1 in congested switch
ī­ if data cell preceding RM cell has EFCI set, sender sets CI
bit in returned RM cell
Transport Layer 3-40
Chapter 3 outline
ī˛ 3.1 Transport-layer
services
ī˛ 3.2 Multiplexing and
demultiplexing
ī˛ 3.3 Connectionless
transport: UDP
ī˛ 3.4 Principles of
reliable data transfer
ī˛ 3.5 Connection-oriented
transport: TCP
ī­ segment structure
ī­ reliable data transfer
ī­ flow control
ī­ connection management
ī˛ 3.6 Principles of
congestion control
ī˛ 3.7 TCP congestion
control
Transport Layer 3-41
TCP Congestion Control
ī˛ end-end control (no network
assistance)
ī˛ sender limits transmission:
LastByteSent-LastByteAcked
ī‚Ŗ CongWin
ī˛ Roughly,
ī˛ CongWin is dynamic, function
of perceived network
congestion
How does sender
perceive congestion?
ī˛ loss event = timeout or
3 duplicate acks
ī˛ TCP sender reduces
rate (CongWin) after
loss event
three mechanisms:
ī­ AIMD
ī­ slow start
ī­ conservative after
timeout events
rate =
CongWin
RTT
Bytes/sec
Transport Layer 3-42
TCP AIMD: Congestion-
Avoidance Phase
8 Kbytes
16 Kbytes
24 Kbytes
time
congestion
window
multiplicative decrease:
cut CongWin in half
after loss event
additive increase:
increase CongWin by
1 MSS every RTT in
the absence of loss
events: probing
Long-lived TCP connection
MSS: maximum
segment size
Transport Layer 3-43
TCP AIMD: Window Updates
ī˛ Suppose CongWin is in num. of MSS
ī˛ At each ACK:
CongWin = CongWin + 1/ CongWin
ī˛ After roughly 1 RTT, CongWin increases
by 1 MSS
W = 8
W = 8
+ 1/8
W = 8.125 + 1/8.125
ī‚ģ 8 + 2/8
W ī‚ģ 8 + 8/8 = 9
W ī‚ģ 9 + 9/9 = 10
Transport Layer 3-44
TCP Slow Start
ī˛ When connection begins,
CongWin = 1 MSS
ī­ Example: MSS = 500
bytes & RTT = 200 msec
ī­ initial rate = 20 kbps
ī˛ available bandwidth may
be >> MSS/RTT
ī­ desirable to quickly ramp
up to respectable rate
ī˛ When connection begins,
increase rate
exponentially fast until
first loss event
Transport Layer 3-45
TCP Slow Start (more)
ī˛ When connection
begins, increase rate
exponentially until
first loss event.
ī˛ At each ACK:
CongWin = CongWin + 1
ī˛ double CongWin every
RTT
ī˛ Summary: initial rate
is slow but ramps up
exponentially fast
Host A
RTT
Host B
time
Transport Layer 3-46
Refinement
ī˛ After 3 dup ACKs:
ī­ CongWin is cut in half
ī­ window then grows
linearly
ī˛ But after timeout event:
ī­ CongWin instead set to
1 MSS;
ī­ window then grows
exponentially
ī­ to a threshold, then
grows linearly
â€ĸ 3 dup ACKs indicates
network capable of
delivering some segments
â€ĸ timeout before 3 dup
ACKs is “more alarming”
Philosophy:
In earlier TCP (TCP-Tahoe)
After detecting 3DA
ī˛ Tahoe set CongWin to 1
MSS and enters slow start
ī˛ Reno cuts CongWin by half
and enters congestion
avoidance. (Fast Recovery)
Transport Layer 3-47
Refinement (more)
Q: When should the
exponential
increase switch to
linear?
A: When CongWin
gets to 1/2 of its
value before
timeout.
Implementation:
ī˛ Variable Threshold
ī˛ At loss event, Threshold is
set to 1/2 of CongWin just
before loss event
0
2
4
6
8
10
12
14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Transmission round
congestion
window
size
(segments) Series1 Series2
threshold
TCP
Tahoe
TCP
Reno
On 3DA (Correction in Note):
ī˛ Tahoe set CongWin to 1
MSS and enters slow start
ī˛ Reno cuts CongWin by half
and enters congestion
avoidance. (Fast Recovery)
Transport Layer 3-48
Summary: TCP Congestion Control (TCP-
Reno)
ī˛ Slow Start
ī­ During CongWin < Threshold
ī­ Exponential increase of window size
ī­ Discover available bandwidth
ī˛ Congestion Avoidance
ī­ During CongWin >= Threshold
ī­ AIMD īƒ  Tries to be fair
ī˛ Refinements:
ī­ Fast Retransmit: after detecting 3DA
ī­ Fast Recovery: also after detecting 3DA
â€ĸ Threshold = CongWin, CongWin to Threshold (instead of 1).
â€ĸ Then, enter congestion avoidance
ī­ Timeout:
â€ĸ set Threshold = CongWin/2, CongWin = 1 MSS
â€ĸ Slow start until CongWin = Threshold, then congestion avoidance
ī˛ Timers: TimeoutInterval = Average + 4 Deviations
ī˛ Flow Control:
ī­ Effective window = min{RcvWindow - Outstanding, CongWin}
Transport Layer 3-49
TCP Reno Typical Trajectory
W
1MSS
65KB
X0.5
TO
3DA
X0.5
3DA TO
X0.5 X0.5
SS CA SS CA
Transport Layer 3-50
Fairness goal: if K TCP sessions share same
bottleneck link of bandwidth R, each should have
average rate of R/K
TCP connection 1
bottleneck
router
capacity R
TCP
connection 2
TCP Fairness
Transport Layer 3-51
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
congestion avoidance: additive increase
loss: decrease window by factor of 2
congestion avoidance: additive increase
loss: decrease window by factor of 2
Transport Layer 3-52
Fairness (more)
Fairness and UDP
ī˛ Multimedia apps often do
not use TCP
ī­ do not want rate throttled
by congestion control
ī˛ Instead use UDP:
ī­ pump audio/video at
constant rate, tolerate
packet loss
ī˛ Problem: during congestion,
TCP slows down, but UDP
does not.
ī˛ Research area: TCP
friendly
Fairness and parallel TCP
connections
ī˛ nothing prevents app from
opening parallel
connections between 2
hosts.
ī˛ Web browsers do this
ī˛ Example: link of rate R
supporting 9 connections;
ī­ new app asks for 1 TCP, gets
rate R/10
ī­ new app asks for 11 TCPs,
gets R/2 !
Transport Layer 3-53
Delay modeling
Q: How long does it take to
receive an object from a
Web server after sending
a request?
Ignoring congestion, delay is
influenced by:
ī˛ TCP connection establishment
ī˛ data transmission delay
ī˛ slow start
Notation, assumptions:
ī˛ Assume one link between
client and server of rate R
ī˛ S: MSS (bits)
ī˛ O: object size (bits)
ī˛ no retransmissions (no loss,
no corruption)
Window size:
ī˛ First assume: fixed
congestion window, W
segments
ī˛ Then dynamic window,
modeling slow start
Transport Layer 3-54
Fixed congestion window (1)
First case:
WS/R > RTT + S/R: ACK for
first segment in window
returns before window’s
worth of data sent
delay = 2RTT + O/R
Transport Layer 3-55
Fixed congestion window (2)
Second case:
ī˛ WS/R < RTT + S/R: wait
for ACK after sending
window’s worth of data
sent
delay = 2RTT + O/R
+ (K-1)[S/R + RTT - WS/R]
K = O/WS: number of windows
Required to transmit O
RTT – (W-1)S/R is server idle time
Transport Layer 3-56
TCP Delay Modeling: Slow Start (1)
Now suppose window grows according to slow start
Will show that the delay for one object is:
R
S
R
S
RTT
P
R
O
RTT
Latency P
)
1
2
(
2 ī€­
ī€­
īƒē
īƒģ
īƒš
īƒĒ
īƒĢ
īƒŠ
ī€Ģ
ī€Ģ
ī€Ģ
ī€Ŋ
where P is the number of times TCP idles at server:
}
1
,
{
min ī€­
ī€Ŋ K
Q
P
- where Q is the number of times the server idles
if the object were of infinite size.
- and K is the number of windows that cover the object.
Transport Layer 3-57
TCP Delay Modeling: Slow Start (2)
RTT
initiate TCP
connection
request
object
first window
= S/R
second window
= 2S/R
third window
= 4S/R
fourth window
= 8S/R
complete
transmission
object
delivered
time at
client
time at
server
Example:
â€ĸ O/S = 15 segments
â€ĸ K = 4 windows
â€ĸ Q = 2
â€ĸ P = min{K-1,Q} = 2
Server idles P=2 times
Delay components:
â€ĸ 2 RTT for connection
establish’t and request
â€ĸ O/R to transmit
object
â€ĸ time server idles due
to slow start
Server idles:
P = min{K-1,Q} times
Transport Layer 3-58
TCP Delay Modeling (3)
R
S
R
S
RTT
P
RTT
R
O
R
S
RTT
R
S
RTT
R
O
idleTime
RTT
R
O
P
k
P
k
P
p
p
)
1
2
(
]
[
2
]
2
[
2
2
delay
1
1
1
ī€­
ī€­
ī€Ģ
ī€Ģ
ī€Ģ
ī€Ŋ
ī€­
ī€Ģ
ī€Ģ
ī€Ģ
ī€Ŋ
ī€Ģ
ī€Ģ
ī€Ŋ
ī€­
ī€Ŋ
ī€Ŋ
īƒĨ
īƒĨ
th window
after the
time
idle
2 1
k
R
S
RTT
R
S k
ī€Ŋ
īƒē
īƒģ
īƒš
īƒĒ
īƒĢ
īƒŠ
ī€­
ī€Ģ
ī€Ģ
ī€­
ement
acknowledg
receives
server
until
segment
send
to
starts
server
when
from
time
ī€Ŋ
ī€Ģ RTT
R
S
window
kth
the
transmit
to
time
2 1
ī€Ŋ
ī€­
R
S
k
RTT
initiate TCP
connection
request
object
first window
= S/R
second window
= 2S/R
third window
= 4S/R
fourth window
= 8S/R
complete
transmission
object
delivered
time at
client
time at
server
= Cycle time – sending time
= Cycle time
= sending time
(note + means >= 0)
= Obj Tx Time + setup + idle time
Transport Layer 3-59
TCP Delay Modeling (4)
īƒē
īƒē
īƒš
īƒĒ
īƒĒ
īƒŠ
ī€Ģ
ī€Ŋ
ī€Ģ
ī‚ŗ
ī€Ŋ
ī‚ŗ
ī€­
ī€Ŋ
ī‚ŗ
ī€Ģ
ī€Ģ
ī€Ģ
ī€Ŋ
ī‚ŗ
ī€Ģ
ī€Ģ
ī€Ģ
ī€Ŋ
ī€­
ī€­
)
1
(
log
)}
1
(
log
:
{
min
}
1
2
:
{
min
}
/
2
2
2
:
{
min
}
2
2
2
:
{
min
2
2
1
1
0
1
1
0
S
O
S
O
k
k
S
O
k
S
O
k
O
S
S
S
k
K
k
k
k
īŒ
īŒ
Calculation of Q, number of idles for infinite-size object,
is similar (see HW).
Recall K = number of windows that cover object
How do we calculate K ?
Normalize to segts
Closed form
Transport Layer 3-60
Web and HTTP
First some jargon
ī˛ Web page consists of objects
ī˛ Object can be HTML file, JPEG image, Java
applet, audio file,â€Ļ
ī˛ Web page consists of base HTML-file which
includes several referenced objects
ī˛ Each object is addressable by a URL
ī˛ Example URL:
www.someschool.edu/someDept/pic.gif
host name path name
Transport Layer 3-61
HTTP overview
HTTP: hypertext
transfer protocol
ī˛ Web’s application layer
protocol
ī˛ client/server model
ī­ client: browser that
requests, receives,
“displays” Web objects
ī­ server: Web server
sends objects in
response to requests
ī˛ HTTP 1.0: RFC 1945
ī˛ HTTP 1.1: RFC 2068
PC running
Explorer
Server
running
Apache Web
server
Mac running
Navigator
Transport Layer 3-62
HTTP overview (continued)
Uses TCP:
ī˛ client initiates TCP
connection (creates socket)
to server, port 80
ī˛ server accepts TCP
connection from client
ī˛ HTTP messages (application-
layer protocol messages)
exchanged between browser
(HTTP client) and Web
server (HTTP server)
ī˛ TCP connection closed
HTTP is “stateless”
ī˛ server maintains no
information about
past client requests
Protocols that maintain
“state” are complex!
ī˛ past history (state) must
be maintained
ī˛ if server/client crashes,
their views of “state” may
be inconsistent, must be
reconciled
aside
Transport Layer 3-63
HTTP connections
Nonpersistent HTTP
ī˛ At most one object is
sent over a TCP
connection.
ī˛ HTTP/1.0 uses
nonpersistent HTTP
Persistent HTTP
ī˛ Multiple objects can
be sent over single
TCP connection
between client and
server.
ī˛ HTTP/1.1 uses
persistent connections
in default mode
Transport Layer 3-64
Nonpersistent HTTP
Suppose user enters URL
www.someSchool.edu/someDepartment/home.index
1a. HTTP client initiates TCP
connection to HTTP server
(process) at
www.someSchool.edu on port 80
2. HTTP client sends HTTP
request message (containing
URL) into TCP connection
socket. Message indicates
that client wants object
someDepartment/home.index
1b. HTTP server at host
www.someSchool.edu waiting
for TCP connection at port 80.
“accepts” connection, notifying
client
3. HTTP server receives request
message, forms response
message containing requested
object, and sends message
into its socket
time
(contains text,
references to 10
jpeg images)
Transport Layer 3-65
Nonpersistent HTTP (cont.)
5. HTTP client receives response
message containing html file,
displays html. Parsing html
file, finds 10 referenced jpeg
objects
6. Steps 1-5 repeated for each
of 10 jpeg objects
4. HTTP server closes TCP
connection.
time
Transport Layer 3-66
Response time modeling
Definition of RRT: time to
send a small packet to
travel from client to
server and back.
Response time:
ī˛ one RTT to initiate TCP
connection
ī˛ one RTT for HTTP
request and first few
bytes of HTTP response
to return
ī˛ file transmission time
total = 2RTT+transmit time
time to
transmit
file
initiate TCP
connection
RTT
request
file
RTT
file
received
time time
Transport Layer 3-67
Persistent HTTP
Nonpersistent HTTP issues:
ī˛ requires 2 RTTs per object
ī˛ OS must work and allocate
host resources for each TCP
connection
ī˛ but browsers often open
parallel TCP connections to
fetch referenced objects
Persistent HTTP
ī˛ server leaves connection
open after sending response
ī˛ subsequent HTTP messages
between same client/server
are sent over connection
Persistent without pipelining:
ī˛ client issues new request
only when previous
response has been received
ī˛ one RTT for each
referenced object
Persistent with pipelining:
ī˛ default in HTTP/1.1
ī˛ client sends requests as
soon as it encounters a
referenced object
ī˛ as little as one RTT for all
the referenced objects
Transport Layer 3-68
HTTP Modeling
ī˛ Assume Web page consists of:
ī­ 1 base HTML page (of size O bits)
ī­ M images (each of size O bits)
ī˛ Non-persistent HTTP:
ī­ M+1 TCP connections in series
ī­ Response time = (M+1)O/R + (M+1)2RTT + sum of idle times
ī˛ Persistent HTTP:
ī­ 2 RTT to request and receive base HTML file
ī­ 1 RTT to request and receive M images
ī­ Response time = (M+1)O/R + 3RTT + sum of idle times
ī˛ Non-persistent HTTP with X parallel connections
ī­ Suppose M/X integer.
ī­ 1 TCP connection for base file
ī­ M/X sets of parallel connections for images.
ī­ Response time = (M+1)O/R + (M/X + 1)2RTT + sum of idle times
Transport Layer 3-69
0
2
4
6
8
10
12
14
16
18
20
28
Kbps
100
Kbps
1
Mbps
10
Mbps
non-persistent
persistent
parallel non-
persistent
HTTP Response time (in seconds)
RTT = 100 msec, O = 5 Kbytes, M=10 and X=5
For low bandwidth, connection & response time dominated by
transmission time.
Persistent connections only give minor improvement over parallel
connections.
Transport Layer 3-70
0
10
20
30
40
50
60
70
28
Kbps
100
Kbps
1
Mbps
10
Mbps
non-persistent
persistent
parallel non-
persistent
HTTP Response time (in seconds)
RTT =1 sec, O = 5 Kbytes, M=10 and X=5
For larger RTT, response time dominated by TCP establishment
& slow start delays. Persistent connections now give important
improvement: particularly in high delayī‚ˇbandwidth networks.
Transport Layer 3-71
Chapter 3: Summary
ī˛ principles behind transport
layer services:
ī­ multiplexing,
demultiplexing
ī­ reliable data transfer
ī­ flow control
ī­ congestion control
ī˛ instantiation and
implementation in the
Internet
ī­ UDP
ī­ TCP
Next:
ī˛ leaving the network
“edge” (application,
transport layers)
ī˛ into the network
“core”

More Related Content

Similar to KandR_TCP (1).ppt notes for congestion control

Week5 lec3-bscs1
Week5 lec3-bscs1Week5 lec3-bscs1
Week5 lec3-bscs1syedhaiderraza
 
Transport Layer in Computer Networks (TCP / UDP / SCTP)
Transport Layer in Computer Networks (TCP / UDP / SCTP)Transport Layer in Computer Networks (TCP / UDP / SCTP)
Transport Layer in Computer Networks (TCP / UDP / SCTP)Hamidreza Bolhasani
 
Chapter3 transport layer
Chapter3 transport layerChapter3 transport layer
Chapter3 transport layerKhÃĄnh Gháēģ
 
Part5-tcp-improvements.pptx
Part5-tcp-improvements.pptxPart5-tcp-improvements.pptx
Part5-tcp-improvements.pptxOlivier Bonaventure
 
COE332-Ch03d.pptx
COE332-Ch03d.pptxCOE332-Ch03d.pptx
COE332-Ch03d.pptxMemMem25
 
High Performance Networking with Advanced TCP
High Performance Networking with Advanced TCPHigh Performance Networking with Advanced TCP
High Performance Networking with Advanced TCPDilum Bandara
 
transport.pptx
transport.pptxtransport.pptx
transport.pptxjatinder42
 
Lecture 5
Lecture 5Lecture 5
Lecture 5ntpc08
 
Computer network
Computer networkComputer network
Computer networkDeepikaT13
 
Transport layer
Transport layerTransport layer
Transport layerreshmadayma
 
Transmission control protocol ...............................
Transmission control protocol ...............................Transmission control protocol ...............................
Transmission control protocol ...............................SwatiHans10
 
Transport layer
Transport layerTransport layer
Transport layerreshmadayma
 
04 MK-PPT End-to-End Protocols.ppt
04 MK-PPT End-to-End Protocols.ppt04 MK-PPT End-to-End Protocols.ppt
04 MK-PPT End-to-End Protocols.pptdhivyak49
 
Transport layer
Transport layerTransport layer
Transport layerarvind pandey
 
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols
5-LEC- 5.pptxTransport Layer. Transport Layer ProtocolsZahouAmel1
 
tcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppttcp-wireless-tutorial.ppt
tcp-wireless-tutorial.pptRadwan Mahmoud
 
Transport Control Protocol
Transport Control ProtocolTransport Control Protocol
Transport Control ProtocolBIT DURG
 
Chapter 11: Data Link Control
Chapter 11: Data Link ControlChapter 11: Data Link Control
Chapter 11: Data Link ControlJeoffnaRuth
 

Similar to KandR_TCP (1).ppt notes for congestion control (20)

Week5 lec3-bscs1
Week5 lec3-bscs1Week5 lec3-bscs1
Week5 lec3-bscs1
 
Transport Layer in Computer Networks (TCP / UDP / SCTP)
Transport Layer in Computer Networks (TCP / UDP / SCTP)Transport Layer in Computer Networks (TCP / UDP / SCTP)
Transport Layer in Computer Networks (TCP / UDP / SCTP)
 
Chapter3 transport layer
Chapter3 transport layerChapter3 transport layer
Chapter3 transport layer
 
Part5-tcp-improvements.pptx
Part5-tcp-improvements.pptxPart5-tcp-improvements.pptx
Part5-tcp-improvements.pptx
 
COE332-Ch03d.pptx
COE332-Ch03d.pptxCOE332-Ch03d.pptx
COE332-Ch03d.pptx
 
High Performance Networking with Advanced TCP
High Performance Networking with Advanced TCPHigh Performance Networking with Advanced TCP
High Performance Networking with Advanced TCP
 
transport.pptx
transport.pptxtransport.pptx
transport.pptx
 
transport protocols
transport protocolstransport protocols
transport protocols
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Computer network
Computer networkComputer network
Computer network
 
Transport layer
Transport layerTransport layer
Transport layer
 
Transmission control protocol ...............................
Transmission control protocol ...............................Transmission control protocol ...............................
Transmission control protocol ...............................
 
Transport layer
Transport layerTransport layer
Transport layer
 
04 MK-PPT End-to-End Protocols.ppt
04 MK-PPT End-to-End Protocols.ppt04 MK-PPT End-to-End Protocols.ppt
04 MK-PPT End-to-End Protocols.ppt
 
Transport layer
Transport layerTransport layer
Transport layer
 
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
 
tcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppttcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppt
 
Mod4
Mod4Mod4
Mod4
 
Transport Control Protocol
Transport Control ProtocolTransport Control Protocol
Transport Control Protocol
 
Chapter 11: Data Link Control
Chapter 11: Data Link ControlChapter 11: Data Link Control
Chapter 11: Data Link Control
 

Recently uploaded

IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoÃŖo Esperancinha
 

Recently uploaded (20)

IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 

KandR_TCP (1).ppt notes for congestion control

  • 1. Transport Layer 3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach Featuring the Internet, 2nd edition. Jim Kurose, Keith Ross Addison-Wesley, July 2002. A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in powerpoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: īą If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!) īą If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Thanks and enjoy! JFK/KWR All material copyright 1996-2002 J.F Kurose and K.W. Ross, All Rights Reserved
  • 2. Transport Layer 3-2 Chapter 3 outline ī˛ 3.1 Transport-layer services ī˛ 3.2 Multiplexing and demultiplexing ī˛ 3.3 Connectionless transport: UDP ī˛ 3.4 Principles of reliable data transfer ī˛ 3.5 Connection-oriented transport: TCP ī­ segment structure ī­ reliable data transfer ī­ flow control ī­ connection management ī˛ 3.6 Principles of congestion control ī˛ 3.7 TCP congestion control
  • 3. Transport Layer 3-3 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 ī˛ full duplex data: ī­ bi-directional data flow in same connection ī­ MSS: maximum segment size ī˛ connection-oriented: ī­ handshaking (exchange of control msgs) init’s sender, receiver state before data exchange ī˛ flow controlled: ī­ sender will not overwhelm receiver ī˛ point-to-point: ī­ one sender, one receiver ī˛ reliable, in-order byte steam: ī­ no “message boundaries” ī˛ pipelined: ī­ TCP congestion and flow control set window size ī˛ send & receive buffers socket door TCP send buffer TCP receive buffer socket door segment application writes data application reads data
  • 4. Transport Layer 3-4 TCP segment structure source port # dest port # 32 bits application data (variable length) sequence number acknowledgement number Receive window Urg data pnter checksum F S R P A U head len not used Options (variable length) URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now (generally not used) RST, SYN, FIN: connection estab (setup, teardown commands) # bytes rcvr willing to accept counting by bytes of data (not segments!) Internet checksum (as in UDP)
  • 5. Transport Layer 3-5 TCP seq. #’s and ACKs Seq. #’s: ī­ byte stream “number” of first byte in segment’s data ACKs: ī­ seq # of next byte expected from other side ī­ cumulative ACK Q: how receiver handles out-of-order segments ī­ A: TCP spec doesn’t say, - up to implementor Host A Host B User types ‘C’ host ACKs receipt of echoed ‘C’ host ACKs receipt of ‘C’, echoes back ‘C’ time simple telnet scenario
  • 6. Transport Layer 3-6 TCP Round Trip Time and Timeout 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, causing low TCP throughput. Q: how to estimate RTT? ī˛ SampleRTT: measured time from segment transmission until ACK receipt ī­ ignore retransmissions ī˛ SampleRTT will vary, want estimated RTT “smoother” ī­ average several recent measurements, not just current SampleRTT
  • 7. Transport Layer 3-7 TCP Round Trip Time and Timeout EstimatedRTT = (1- īĄ)*EstimatedRTT + īĄ*SampleRTT ī˛ Exponential weighted moving average ī˛ influence of past sample decreases exponentially fast ī˛ typical value: īĄ = 0.125
  • 8. Transport Layer 3-8 Example RTT estimation: RTT: gaia.cs.umass.edu to fantasia.eurecom.fr 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 (milliseconds) SampleRTT Estimated RTT
  • 9. Transport Layer 3-9 TCP Round Trip Time and Timeout Setting the timeout ī˛ EstimtedRTT plus “safety margin” ī­ large variation in EstimatedRTT -> larger safety margin ī˛ first estimate of how much SampleRTT deviates from EstimatedRTT: TimeoutInterval = EstimatedRTT + 4*DevRTT DevRTT = (1-īĸ)*DevRTT + īĸ*|SampleRTT-EstimatedRTT| (typically, īĸ = 0.25) Then set timeout interval:
  • 10. Transport Layer 3-10 Example RTT estimation: RTT Estimation and Timeout 0 50 100 150 200 250 300 350 400 450 500 1 14 27 40 53 66 79 92 105 sample # RTT (ms) RTT sample RTT est Dev est Timeout
  • 11. Transport Layer 3-11 Chapter 3 outline ī˛ 3.1 Transport-layer services ī˛ 3.2 Multiplexing and demultiplexing ī˛ 3.3 Connectionless transport: UDP ī˛ 3.4 Principles of reliable data transfer ī˛ 3.5 Connection-oriented transport: TCP ī­ segment structure ī­ reliable data transfer ī­ flow control ī­ connection management ī˛ 3.6 Principles of congestion control ī˛ 3.7 TCP congestion control
  • 12. Transport Layer 3-12 TCP reliable data transfer ī˛ TCP creates rdt service on top of IP’s unreliable service ī˛ Pipelined segments ī˛ Cumulative acks ī˛ TCP uses single retransmission timer ī˛ Retransmissions are triggered by: ī­ timeout events ī­ duplicate acks ī˛ Initially consider simplified TCP sender: ī­ ignore duplicate acks ī­ ignore flow control, congestion control
  • 13. Transport Layer 3-13 TCP sender events: data rcvd from app: ī˛ Create segment with seq # ī˛ seq # is byte-stream number of first data byte in segment ī˛ start timer if not already running (think of timer as for oldest unacked segment) ī˛ expiration interval: TimeOutInterval timeout: ī˛ retransmit segment that caused timeout ī˛ restart timer Ack rcvd: ī˛ If acknowledges previously unacked segments ī­ update what is known to be acked ī­ start timer if there are outstanding segments
  • 14. Transport Layer 3-14 TCP sender (simplified) NextSeqNum = InitialSeqNum SendBase = InitialSeqNum loop (forever) { switch(event) event: data received from application above create TCP segment with sequence number NextSeqNum if (timer currently not running) start timer pass segment to IP NextSeqNum = NextSeqNum + length(data) event: timer timeout retransmit not-yet-acknowledged segment with smallest sequence number start timer event: ACK received, with ACK field value of y if (y > SendBase) { SendBase = y if (there are currently not-yet-acknowledged segments) start timer } } /* end of loop forever */ Comment: â€ĸ SendBase-1: last cumulatively ack’ed byte Example: â€ĸ SendBase-1 = 71; y= 73, so the rcvr wants 73+ ; y > SendBase, so that new data is acked
  • 15. Transport Layer 3-15 TCP: retransmission scenarios Host A time premature timeout Host B Seq=92 timeout Host A loss timeout lost ACK scenario Host B X time Seq=92 timeout SendBase = 100 SendBase = 120 SendBase = 120 Sendbase = 100 Start timing Packet (100)
  • 16. Transport Layer 3-16 TCP retransmission scenarios (more) Host A loss timeout Cumulative ACK scenario Host B X time SendBase = 120
  • 17. Transport Layer 3-17 TCP ACK generation [RFC 1122, RFC 2581] Event at Receiver Arrival of in-order segment with expected seq #. All data up to expected seq # already ACKed Arrival of in-order segment with expected seq #. One other segment has ACK pending Arrival of out-of-order segment higher-than-expect seq. # . Gap detected Arrival of segment that partially or completely fills gap TCP Receiver action Delayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK Immediately send single cumulative ACK, ACKing both in-order segments Immediately send duplicate ACK, indicating seq. # of next expected byte Immediate send ACK, update next Expected byte
  • 18. Transport Layer 3-18 Fast Retransmit ī˛ Time-out period often relatively long: ī­ long delay before resending lost packet ī˛ Detect lost segments via duplicate ACKs. ī­ Sender often sends many segments back-to- back ī­ If segment is lost, there will likely be many duplicate ACKs. ī˛ If sender receives 3 ACKs for the same data, it supposes that segment after ACKed data was lost: ī­ fast retransmit: resend segment before timer expires
  • 19. Transport Layer 3-19 event: ACK received, with ACK field value of y if (y > SendBase) { SendBase = y if (there are currently not-yet-acknowledged segments) start timer } else { increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) { resend segment with sequence number y } Fast retransmit algorithm: a duplicate ACK for already ACKed segment fast retransmit
  • 20. Transport Layer 3-20 Doubling Timeout Interval ī˛ Many TCP implementations double the next TimeoutInterval after a timer expiration. ī˛ This typically happens at ī­ beginning of a connection ī­ when sending the first packet after a long quiet period ī˛ This is one form of congestion control ī­ Timer expiration due to packet loss ī­ Doubling TimeoutInterval leads to exponential slowing down of transmission.
  • 21. Transport Layer 3-21 Selective Acknowledgement (SACK) ī˛ TCP resembles Go-Back-N but ī­ But, it retransmits only one packet at a time, not the subsequent packets ī˛ TCP has an option of Selective Acknowledgement ī­ Uses the optional fields in the TCP header ī­ Receiver indicates consecutive blocks of received, but out-of-order, data ī­ With this option, TCP looks like Selective Repeat +--------+--------+--------+--------+ | Left Edge of 1st Block | +--------+--------+--------+--------+ | Right Edge of 1st Block | +--------+--------+--------+--------+ | | / . . . / | | +--------+--------+--------+--------+ | Left Edge of nth Block | +--------+--------+--------+--------+ | Right Edge of nth Block | +--------+--------+--------+--------+
  • 22. Transport Layer 3-22 Chapter 3 outline ī˛ 3.1 Transport-layer services ī˛ 3.2 Multiplexing and demultiplexing ī˛ 3.3 Connectionless transport: UDP ī˛ 3.4 Principles of reliable data transfer ī˛ 3.5 Connection-oriented transport: TCP ī­ segment structure ī­ reliable data transfer ī­ flow control ī­ connection management ī˛ 3.6 Principles of congestion control ī˛ 3.7 TCP congestion control
  • 23. Transport Layer 3-23 TCP Flow Control ī˛ receive side of TCP connection has a receive buffer: ī˛ speed-matching service: matching the send rate to the receiving app’s drain rate ī˛ app process may be slow at reading from buffer sender won’t overflow receiver’s buffer by transmitting too much, too fast flow control
  • 24. Transport Layer 3-24 TCP Flow control: how it works (Suppose TCP receiver discards out-of-order segments) ī˛ spare room in buffer = RcvWindow = RcvBuffer-[LastByteRcvd - LastByteRead] ī˛ Rcvr advertises spare room by including value of RcvWindow in segments ī˛ Sender limits unACKed data to RcvWindow ī­ guarantees receive buffer doesn’t overflow
  • 25. Transport Layer 3-25 Chapter 3 outline ī˛ 3.1 Transport-layer services ī˛ 3.2 Multiplexing and demultiplexing ī˛ 3.3 Connectionless transport: UDP ī˛ 3.4 Principles of reliable data transfer ī˛ 3.5 Connection-oriented transport: TCP ī­ segment structure ī­ reliable data transfer ī­ flow control ī­ connection management ī˛ 3.6 Principles of congestion control ī˛ 3.7 TCP congestion control
  • 26. Transport Layer 3-26 TCP Connection Management Recall: TCP sender, receiver establish “connection” before exchanging data segments ī˛ initialize TCP variables: ī­ seq. #s ī­ buffers, flow control info (e.g. RcvWindow) ī˛ client: connection initiator Socket clientSocket = new Socket("hostname","port number"); ī˛ server: contacted by client Socket connectionSocket = welcomeSocket.accept(); Three way handshake: Step 1: client host sends TCP SYN segment to server ī­ specifies initial seq # ī­ no data Step 2: server host receives SYN, replies with SYNACK segment ī­ server allocates buffers ī­ specifies server initial seq. # Step 3: client receives SYNACK, replies with ACK segment, which may contain data
  • 27. Transport Layer 3-27 TCP Connection Management (cont.) Closing a connection: client closes socket: clientSocket.close(); Step 1: client end system sends TCP FIN control segment to server Step 2: server receives FIN, replies with ACK. Closes connection, sends FIN. client server close close closed timed wait
  • 28. Transport Layer 3-28 TCP Connection Management (cont.) Step 3: client receives FIN, replies with ACK. ī­ Enters “timed wait” - will respond with ACK to received FINs Step 4: server, receives ACK. Connection closed. Note: with small modification, can handle simultaneous FINs. client server closing closing closed timed wait closed
  • 29. Transport Layer 3-29 TCP Connection Management (cont) TCP client lifecycle TCP server lifecycle For full FSM, see handout.
  • 30. Transport Layer 3-30 Chapter 3 outline ī˛ 3.1 Transport-layer services ī˛ 3.2 Multiplexing and demultiplexing ī˛ 3.3 Connectionless transport: UDP ī˛ 3.4 Principles of reliable data transfer ī˛ 3.5 Connection-oriented transport: TCP ī­ segment structure ī­ reliable data transfer ī­ flow control ī­ connection management ī˛ 3.6 Principles of congestion control ī˛ 3.7 TCP congestion control
  • 31. Transport Layer 3-31 Principles of Congestion Control Congestion: ī˛ informally: “too many sources sending too much data too fast for network to handle” ī˛ different from flow control! ī˛ manifestations: ī­ lost packets (buffer overflow at routers) ī­ long delays (queueing in router buffers) ī˛ a top-10 problem!
  • 32. Transport Layer 3-32 Causes/costs of congestion: scenario 1 ī˛ two senders, two receivers ī˛ one router, infinite buffers ī˛ no retransmission ī˛ large delays when congested ī˛ maximum achievable throughput unlimited shared output link buffers Host A lin : original data Host B lout
  • 33. Transport Layer 3-33 Causes/costs of congestion: scenario 2 ī˛ one router, finite buffers ī˛ sender retransmission of lost packet finite shared output link buffers Host A lin : original data Host B lout l'in : original data, plus retransmitted data
  • 34. Transport Layer 3-34 Causes/costs of congestion: scenario 2 ī˛ always: (goodput) ī˛ “perfect” retransmission only when loss: ī˛ retransmission of delayed (not lost) packet makes larger (than perfect case) for same l in lout = l in lout > l in lout “costs” of congestion: ī˛ more work (retrans) for given “goodput” ī˛ unneeded retransmissions: link carries multiple copies of pkt
  • 35. Transport Layer 3-35 Causes/costs of congestion: scenario 3 ī˛ four senders ī˛ multihop paths ī˛ timeout/retransmit l in Q: what happens as and increase ? l in finite shared output link buffers Host A lin : original data Host D lout l'in : original data, plus retransmitted data Host B Host C R1 R2
  • 36. Transport Layer 3-36 Causes/costs of congestion: scenario 3 Another “cost” of congestion: ī˛ when packet dropped, any “upstream transmission capacity used for that packet was wasted! H o s t A H o s t B l o u t
  • 37. Transport Layer 3-37 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 ī­ single bit indicating congestion (SNA, DECbit, TCP/IP ECN, ATM) ī­ explicit rate sender should send at Two broad approaches towards congestion control:
  • 38. Transport Layer 3-38 Case study: ATM ABR congestion control ABR: available bit rate: ī˛ “elastic service” ī˛ if sender’s path “underloaded”: ī­ sender should use available bandwidth ī˛ if sender’s path congested: ī­ sender throttled to minimum guaranteed rate RM (resource management) cells: ī˛ sent by sender, interspersed with data cells ī˛ bits in RM cell set by switches (“network-assisted”) ī­ NI bit: no increase in rate (mild congestion) ī­ CI bit: congestion indication ī˛ RM cells returned to sender by receiver, with bits intact
  • 39. Transport Layer 3-39 Case study: ATM ABR congestion control ī˛ two-byte ER (explicit rate) field in RM cell ī­ congested switch may lower ER value in cell ī­ sender’ send rate thus minimum supportable rate on path ī˛ EFCI bit in data cells: set to 1 in congested switch ī­ if data cell preceding RM cell has EFCI set, sender sets CI bit in returned RM cell
  • 40. Transport Layer 3-40 Chapter 3 outline ī˛ 3.1 Transport-layer services ī˛ 3.2 Multiplexing and demultiplexing ī˛ 3.3 Connectionless transport: UDP ī˛ 3.4 Principles of reliable data transfer ī˛ 3.5 Connection-oriented transport: TCP ī­ segment structure ī­ reliable data transfer ī­ flow control ī­ connection management ī˛ 3.6 Principles of congestion control ī˛ 3.7 TCP congestion control
  • 41. Transport Layer 3-41 TCP Congestion Control ī˛ end-end control (no network assistance) ī˛ sender limits transmission: LastByteSent-LastByteAcked ī‚Ŗ CongWin ī˛ Roughly, ī˛ CongWin is dynamic, function of perceived network congestion How does sender perceive congestion? ī˛ loss event = timeout or 3 duplicate acks ī˛ TCP sender reduces rate (CongWin) after loss event three mechanisms: ī­ AIMD ī­ slow start ī­ conservative after timeout events rate = CongWin RTT Bytes/sec
  • 42. Transport Layer 3-42 TCP AIMD: Congestion- Avoidance Phase 8 Kbytes 16 Kbytes 24 Kbytes time congestion window multiplicative decrease: cut CongWin in half after loss event additive increase: increase CongWin by 1 MSS every RTT in the absence of loss events: probing Long-lived TCP connection MSS: maximum segment size
  • 43. Transport Layer 3-43 TCP AIMD: Window Updates ī˛ Suppose CongWin is in num. of MSS ī˛ At each ACK: CongWin = CongWin + 1/ CongWin ī˛ After roughly 1 RTT, CongWin increases by 1 MSS W = 8 W = 8 + 1/8 W = 8.125 + 1/8.125 ī‚ģ 8 + 2/8 W ī‚ģ 8 + 8/8 = 9 W ī‚ģ 9 + 9/9 = 10
  • 44. Transport Layer 3-44 TCP Slow Start ī˛ When connection begins, CongWin = 1 MSS ī­ Example: MSS = 500 bytes & RTT = 200 msec ī­ initial rate = 20 kbps ī˛ available bandwidth may be >> MSS/RTT ī­ desirable to quickly ramp up to respectable rate ī˛ When connection begins, increase rate exponentially fast until first loss event
  • 45. Transport Layer 3-45 TCP Slow Start (more) ī˛ When connection begins, increase rate exponentially until first loss event. ī˛ At each ACK: CongWin = CongWin + 1 ī˛ double CongWin every RTT ī˛ Summary: initial rate is slow but ramps up exponentially fast Host A RTT Host B time
  • 46. Transport Layer 3-46 Refinement ī˛ After 3 dup ACKs: ī­ CongWin is cut in half ī­ window then grows linearly ī˛ But after timeout event: ī­ CongWin instead set to 1 MSS; ī­ window then grows exponentially ī­ to a threshold, then grows linearly â€ĸ 3 dup ACKs indicates network capable of delivering some segments â€ĸ timeout before 3 dup ACKs is “more alarming” Philosophy: In earlier TCP (TCP-Tahoe) After detecting 3DA ī˛ Tahoe set CongWin to 1 MSS and enters slow start ī˛ Reno cuts CongWin by half and enters congestion avoidance. (Fast Recovery)
  • 47. Transport Layer 3-47 Refinement (more) Q: When should the exponential increase switch to linear? A: When CongWin gets to 1/2 of its value before timeout. Implementation: ī˛ Variable Threshold ī˛ At loss event, Threshold is set to 1/2 of CongWin just before loss event 0 2 4 6 8 10 12 14 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Transmission round congestion window size (segments) Series1 Series2 threshold TCP Tahoe TCP Reno On 3DA (Correction in Note): ī˛ Tahoe set CongWin to 1 MSS and enters slow start ī˛ Reno cuts CongWin by half and enters congestion avoidance. (Fast Recovery)
  • 48. Transport Layer 3-48 Summary: TCP Congestion Control (TCP- Reno) ī˛ Slow Start ī­ During CongWin < Threshold ī­ Exponential increase of window size ī­ Discover available bandwidth ī˛ Congestion Avoidance ī­ During CongWin >= Threshold ī­ AIMD īƒ  Tries to be fair ī˛ Refinements: ī­ Fast Retransmit: after detecting 3DA ī­ Fast Recovery: also after detecting 3DA â€ĸ Threshold = CongWin, CongWin to Threshold (instead of 1). â€ĸ Then, enter congestion avoidance ī­ Timeout: â€ĸ set Threshold = CongWin/2, CongWin = 1 MSS â€ĸ Slow start until CongWin = Threshold, then congestion avoidance ī˛ Timers: TimeoutInterval = Average + 4 Deviations ī˛ Flow Control: ī­ Effective window = min{RcvWindow - Outstanding, CongWin}
  • 49. Transport Layer 3-49 TCP Reno Typical Trajectory W 1MSS 65KB X0.5 TO 3DA X0.5 3DA TO X0.5 X0.5 SS CA SS CA
  • 50. Transport Layer 3-50 Fairness goal: if K TCP sessions share same bottleneck link of bandwidth R, each should have average rate of R/K TCP connection 1 bottleneck router capacity R TCP connection 2 TCP Fairness
  • 51. Transport Layer 3-51 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 congestion avoidance: additive increase loss: decrease window by factor of 2 congestion avoidance: additive increase loss: decrease window by factor of 2
  • 52. Transport Layer 3-52 Fairness (more) Fairness and UDP ī˛ Multimedia apps often do not use TCP ī­ do not want rate throttled by congestion control ī˛ Instead use UDP: ī­ pump audio/video at constant rate, tolerate packet loss ī˛ Problem: during congestion, TCP slows down, but UDP does not. ī˛ Research area: TCP friendly Fairness and parallel TCP connections ī˛ nothing prevents app from opening parallel connections between 2 hosts. ī˛ Web browsers do this ī˛ Example: link of rate R supporting 9 connections; ī­ new app asks for 1 TCP, gets rate R/10 ī­ new app asks for 11 TCPs, gets R/2 !
  • 53. Transport Layer 3-53 Delay modeling Q: How long does it take to receive an object from a Web server after sending a request? Ignoring congestion, delay is influenced by: ī˛ TCP connection establishment ī˛ data transmission delay ī˛ slow start Notation, assumptions: ī˛ Assume one link between client and server of rate R ī˛ S: MSS (bits) ī˛ O: object size (bits) ī˛ no retransmissions (no loss, no corruption) Window size: ī˛ First assume: fixed congestion window, W segments ī˛ Then dynamic window, modeling slow start
  • 54. Transport Layer 3-54 Fixed congestion window (1) First case: WS/R > RTT + S/R: ACK for first segment in window returns before window’s worth of data sent delay = 2RTT + O/R
  • 55. Transport Layer 3-55 Fixed congestion window (2) Second case: ī˛ WS/R < RTT + S/R: wait for ACK after sending window’s worth of data sent delay = 2RTT + O/R + (K-1)[S/R + RTT - WS/R] K = O/WS: number of windows Required to transmit O RTT – (W-1)S/R is server idle time
  • 56. Transport Layer 3-56 TCP Delay Modeling: Slow Start (1) Now suppose window grows according to slow start Will show that the delay for one object is: R S R S RTT P R O RTT Latency P ) 1 2 ( 2 ī€­ ī€­ īƒē īƒģ īƒš īƒĒ īƒĢ īƒŠ ī€Ģ ī€Ģ ī€Ģ ī€Ŋ where P is the number of times TCP idles at server: } 1 , { min ī€­ ī€Ŋ K Q P - where Q is the number of times the server idles if the object were of infinite size. - and K is the number of windows that cover the object.
  • 57. Transport Layer 3-57 TCP Delay Modeling: Slow Start (2) RTT initiate TCP connection request object first window = S/R second window = 2S/R third window = 4S/R fourth window = 8S/R complete transmission object delivered time at client time at server Example: â€ĸ O/S = 15 segments â€ĸ K = 4 windows â€ĸ Q = 2 â€ĸ P = min{K-1,Q} = 2 Server idles P=2 times Delay components: â€ĸ 2 RTT for connection establish’t and request â€ĸ O/R to transmit object â€ĸ time server idles due to slow start Server idles: P = min{K-1,Q} times
  • 58. Transport Layer 3-58 TCP Delay Modeling (3) R S R S RTT P RTT R O R S RTT R S RTT R O idleTime RTT R O P k P k P p p ) 1 2 ( ] [ 2 ] 2 [ 2 2 delay 1 1 1 ī€­ ī€­ ī€Ģ ī€Ģ ī€Ģ ī€Ŋ ī€­ ī€Ģ ī€Ģ ī€Ģ ī€Ŋ ī€Ģ ī€Ģ ī€Ŋ ī€­ ī€Ŋ ī€Ŋ īƒĨ īƒĨ th window after the time idle 2 1 k R S RTT R S k ī€Ŋ īƒē īƒģ īƒš īƒĒ īƒĢ īƒŠ ī€­ ī€Ģ ī€Ģ ī€­ ement acknowledg receives server until segment send to starts server when from time ī€Ŋ ī€Ģ RTT R S window kth the transmit to time 2 1 ī€Ŋ ī€­ R S k RTT initiate TCP connection request object first window = S/R second window = 2S/R third window = 4S/R fourth window = 8S/R complete transmission object delivered time at client time at server = Cycle time – sending time = Cycle time = sending time (note + means >= 0) = Obj Tx Time + setup + idle time
  • 59. Transport Layer 3-59 TCP Delay Modeling (4) īƒē īƒē īƒš īƒĒ īƒĒ īƒŠ ī€Ģ ī€Ŋ ī€Ģ ī‚ŗ ī€Ŋ ī‚ŗ ī€­ ī€Ŋ ī‚ŗ ī€Ģ ī€Ģ ī€Ģ ī€Ŋ ī‚ŗ ī€Ģ ī€Ģ ī€Ģ ī€Ŋ ī€­ ī€­ ) 1 ( log )} 1 ( log : { min } 1 2 : { min } / 2 2 2 : { min } 2 2 2 : { min 2 2 1 1 0 1 1 0 S O S O k k S O k S O k O S S S k K k k k īŒ īŒ Calculation of Q, number of idles for infinite-size object, is similar (see HW). Recall K = number of windows that cover object How do we calculate K ? Normalize to segts Closed form
  • 60. Transport Layer 3-60 Web and HTTP First some jargon ī˛ Web page consists of objects ī˛ Object can be HTML file, JPEG image, Java applet, audio file,â€Ļ ī˛ Web page consists of base HTML-file which includes several referenced objects ī˛ Each object is addressable by a URL ī˛ Example URL: www.someschool.edu/someDept/pic.gif host name path name
  • 61. Transport Layer 3-61 HTTP overview HTTP: hypertext transfer protocol ī˛ Web’s application layer protocol ī˛ client/server model ī­ client: browser that requests, receives, “displays” Web objects ī­ server: Web server sends objects in response to requests ī˛ HTTP 1.0: RFC 1945 ī˛ HTTP 1.1: RFC 2068 PC running Explorer Server running Apache Web server Mac running Navigator
  • 62. Transport Layer 3-62 HTTP overview (continued) Uses TCP: ī˛ client initiates TCP connection (creates socket) to server, port 80 ī˛ server accepts TCP connection from client ī˛ HTTP messages (application- layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server) ī˛ TCP connection closed HTTP is “stateless” ī˛ server maintains no information about past client requests Protocols that maintain “state” are complex! ī˛ past history (state) must be maintained ī˛ if server/client crashes, their views of “state” may be inconsistent, must be reconciled aside
  • 63. Transport Layer 3-63 HTTP connections Nonpersistent HTTP ī˛ At most one object is sent over a TCP connection. ī˛ HTTP/1.0 uses nonpersistent HTTP Persistent HTTP ī˛ Multiple objects can be sent over single TCP connection between client and server. ī˛ HTTP/1.1 uses persistent connections in default mode
  • 64. Transport Layer 3-64 Nonpersistent HTTP Suppose user enters URL www.someSchool.edu/someDepartment/home.index 1a. HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80 2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index 1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client 3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket time (contains text, references to 10 jpeg images)
  • 65. Transport Layer 3-65 Nonpersistent HTTP (cont.) 5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects 6. Steps 1-5 repeated for each of 10 jpeg objects 4. HTTP server closes TCP connection. time
  • 66. Transport Layer 3-66 Response time modeling Definition of RRT: time to send a small packet to travel from client to server and back. Response time: ī˛ one RTT to initiate TCP connection ī˛ one RTT for HTTP request and first few bytes of HTTP response to return ī˛ file transmission time total = 2RTT+transmit time time to transmit file initiate TCP connection RTT request file RTT file received time time
  • 67. Transport Layer 3-67 Persistent HTTP Nonpersistent HTTP issues: ī˛ requires 2 RTTs per object ī˛ OS must work and allocate host resources for each TCP connection ī˛ but browsers often open parallel TCP connections to fetch referenced objects Persistent HTTP ī˛ server leaves connection open after sending response ī˛ subsequent HTTP messages between same client/server are sent over connection Persistent without pipelining: ī˛ client issues new request only when previous response has been received ī˛ one RTT for each referenced object Persistent with pipelining: ī˛ default in HTTP/1.1 ī˛ client sends requests as soon as it encounters a referenced object ī˛ as little as one RTT for all the referenced objects
  • 68. Transport Layer 3-68 HTTP Modeling ī˛ Assume Web page consists of: ī­ 1 base HTML page (of size O bits) ī­ M images (each of size O bits) ī˛ Non-persistent HTTP: ī­ M+1 TCP connections in series ī­ Response time = (M+1)O/R + (M+1)2RTT + sum of idle times ī˛ Persistent HTTP: ī­ 2 RTT to request and receive base HTML file ī­ 1 RTT to request and receive M images ī­ Response time = (M+1)O/R + 3RTT + sum of idle times ī˛ Non-persistent HTTP with X parallel connections ī­ Suppose M/X integer. ī­ 1 TCP connection for base file ī­ M/X sets of parallel connections for images. ī­ Response time = (M+1)O/R + (M/X + 1)2RTT + sum of idle times
  • 69. Transport Layer 3-69 0 2 4 6 8 10 12 14 16 18 20 28 Kbps 100 Kbps 1 Mbps 10 Mbps non-persistent persistent parallel non- persistent HTTP Response time (in seconds) RTT = 100 msec, O = 5 Kbytes, M=10 and X=5 For low bandwidth, connection & response time dominated by transmission time. Persistent connections only give minor improvement over parallel connections.
  • 70. Transport Layer 3-70 0 10 20 30 40 50 60 70 28 Kbps 100 Kbps 1 Mbps 10 Mbps non-persistent persistent parallel non- persistent HTTP Response time (in seconds) RTT =1 sec, O = 5 Kbytes, M=10 and X=5 For larger RTT, response time dominated by TCP establishment & slow start delays. Persistent connections now give important improvement: particularly in high delayī‚ˇbandwidth networks.
  • 71. Transport Layer 3-71 Chapter 3: Summary ī˛ principles behind transport layer services: ī­ multiplexing, demultiplexing ī­ reliable data transfer ī­ flow control ī­ congestion control ī˛ instantiation and implementation in the Internet ī­ UDP ī­ TCP Next: ī˛ leaving the network “edge” (application, transport layers) ī˛ into the network “core”