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
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â