Kuliah_06 - Transport Layer (TCP)
-
Upload
hery-nugroho -
Category
Documents
-
view
222 -
download
0
Transcript of Kuliah_06 - Transport Layer (TCP)
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
1/54
Transport Layer 3-1
Chapter 3
TransportLayer
ComputerNetworking: ATop Down
Approach
6th
editionJim Kurose, KeithRossAddison-WesleyMarch !1
A note on the use of these ppt slides:Were making these slides freely available to all (faculty, students, readers).
Theyre in o!eroint form so you see the animations" and can add, modify,
and delete slides (including this one) and slide content to suit your needs.
They obviously represent a lotof !ork on our part. #n return for use, !e only
ask the follo!ing:
#f you use these slides (e.g., in a class) that you mention their source
(after all, !ed like people to use our book$) #f you post any slides on a !!! site, that you note that they are adapted
from (or perhaps identical to) our slides, and note our copyright of this
material.
Thanks and en%oy$ &'W*
All material copyright +-/0+/ &.' urose and .W. *oss, All *ights *eserved
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
2/54
TransportLayer 3-
Chapter 3 outline
3"1 transport-layerser#ices
3" multiple$in%
anddemultiple$in%
3"3 connectionlesstransport& '()
3"* principles o+reliale datatrans+er
3.5 connection-oriented
transport: TCP
se%ment structure
reliale datatrans+er
o. control
connection
mana%ement3.6 principles of congestion
control
3.7 TCP congestion control
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
3/54
TransportLayer 3-3
TC)& /#er#ie. R0Cs& 23,11,133,!1, 41
+ull duple$ data& i-directional data
o. in sameconnection
M55& ma$imumse%ment sie
connection-
oriented& handsha7in%
8e$chan%e o+control ms%s9 inits
sender, recei#erstate e+ore data
point-to-point:
one sender, onerecei#er
:multicastin%; reliable, in-order byte
stream:
no :messa%e
oundaries; pipelined:
TC) con%estion ando. control set
.indo. sie5& the ma$" amount o+ data that can e %raed and place in a se%ment"
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
4/54
TC) send and recei#eu=ers
TransportLayer 3-*
TC)sendu=er
TC)recei#eu=er
soc7et soc7et
)rocess.rites data
)rocessreads data
se%ment se%ment
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
5/54
TransportLayer 3-4
TC) se%ment structure
source port 1 dest port 1
2/ bits
applicationdata
(variable length)
se3uence number
ackno!ledgement number
receive !indo!
4rg data pointerchecksum
'5*A4head
len
not
used
options (variable length)
4*6: urgent data(generally not used)
A7: A7 1
valid
58: push data no!
(generally not used)
*5T, 59, '#:
connection estab
(setup, teardo!n
commands)
#nternet
checksum
(as in 4;)
1 bytesrcvr !illing
to accept
counting
by bytes
of data
(not segments$)
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
6/54
TransportLayer 3-6
TC) se>" numers, ACKs
se>uence numers&yte stream:numer; o+ ?rstyte in se%ment@s
dataac7no.led%ements&
se> o+ ne$t ytee$pected +rom other
sidecumulati#e ACK
B&ho. recei#erhandles out-o+-order
se%mentsA& TC) s ec doesn@t
source port 1 dest port 1
se3uence number
ackno!ledgement number
checksum
r!nd
urg pointer
incomin% se%ment to sender
A
sentACKed
sent, not-yetACKed8:in-i%ht;9
usaleut notyet sent
notusale
.indo. sieN
sender sequence number space
source port 1 dest port 1
se3uence number
ackno!ledgement number
checksum
r!nd
urg pointer
out%oin% se%ment +rom sender
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
7/54TransportLayer 3-
(i#idin% ?le data into TC) se%ments
! 1 1,!!! 1,222 *22,222
(ata +or 1stse%ment (ata +or ndse%ment
0ile
1stse>" numer ! ndse>" numer 1!!!
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
8/54TransportLayer 3-
TC) se>" numers, ACKs
'sertypes
DC@
host ACKsreceipt
o+ echoed
DC@
host ACKsreceipt o+DC@, echoesac7 DC@
simple telnet scenario
Eost FEost A
5e>*, ACK2, data DC@
5e3
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
9/54TransportLayer 3-2
TC) round trip time,timeoutB&ho. to setTC) timeout#alueG
lon%er than RTT ut RTT #aries
too short:premature
timeout,unnecessaryretransmissions
too long:slo.
reaction to
Q:how to estimate TT! SampleRTT:meas"red
time from segment
transmission "ntil #C$
receipt
i%noreretransmissions
SampleRTTwill %ar&,
want estimated TT'smoother(
a#era%e se#eralrecent
measurements, not
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
10/54
TransportLayer 3-1!
EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT
e$ponential .ei%hted mo#in% a#era%e inuence o+ past sample decreases
e$ponentially +ast typical #alue& =!"14
TC) round trip time,timeout
RTT8milliseconds9
*TT:gaia.cs.umass.edutofantasia.eurecom.fr
sampleRTT
IstimatedRTT
time
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
11/54
TransportLayer 3-11
timeout inter#al&EstimatedRTTplus :sa+etymar%in; lar%e #ariation in EstimatedRTT ->lar%er sa+ety
mar%in
estimate 5ampleRTT de#iation +romIstimatedRTT&
DevRTT = (1-)*DevRTT +
*|SampleRTT-EstimatedRTT|
TC) round trip time,timeout
(typically, = 0.2)
Time!"t#$te%val = EstimatedRTT + &*DevRTT
estimated RTT :sa+ety mar%in;
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
12/54
TransportLayer 3-1
Chapter 3 outline
3"1 transport-layerser#ices
3" multiple$in%
anddemultiple$in%
3"3 connectionlesstransport& '()
3"* principles o+reliale datatrans+er
3.5 connection-oriented
transport: TCP
se%ment structure
reliale datatrans+er
o. control
connection
mana%ement3.6 principles of congestion
control
3.7 TCP congestion control
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
13/54
TransportLayer 3-13
TC) reliale data trans+er
TC) creates rdtser#ice on top o+)@s unreliale
ser#ice pipelined se%ments cumulati#e ac7s
sin%le
retransmission timer retransmissions
tri%%ered y& timeout e#ents
duplicate ac7s
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
14/54
TransportLayer 3-1*
TC) sender e#ents&
data rcvd from app: create se%ment
.ith se> se> is yte-
stream numer o+?rst data yte inse%ment
start timer i+ notalready runnin% thin7 o+ timer as
+or oldest unac7edse%ment
e$piration inter#al&
timeout: retransmit segment
that ca"sed timeo"t
restart timer
ack rcvd:
if ac) ac)nowledges
pre%io"sl& "nac)ed
segments update .hat is
7no.n to eACKed
start timer i+ thereare still unac7ed
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
15/54
TransportLayer 3-14
TC)& retransmissionscenarios
lost ACK scenario
Eost FEost A
5e>2, ytes o+ data
A72, ytes o+ data
Xtimeo
ut
A72, ytes o+ data
A72, ytes o+ data
timeo
ut
A71!!, ! ytes o+ data
A7
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
16/54
TransportLayer 3-16
TC)& retransmissionscenarios
X
cumulati#e ACK
Eost FEost A
5e>2, ytes o+ data
A71!, 14 ytes o+ data
timeout
5e>1!!, ! ytes o+ data
A7
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
17/54
TransportLayer 3-1
TC) ACK %enerationR0C 11, R0C41
event at receiver
arrival of inorder segment !ith
epected se3 1. All data up to
epected se3 1 already A7ed
arrival of inorder segment !ith
epected se3 1. Bne other
segment has A7 pending
arrival of outoforder segment
higherthanepect se3. 1 .6ap detected
arrival of segment that
partially or completely fills gap
TCP receiver action
delayed A7. Wait up to C00ms
for net segment. #f no net segment,
send A7
immediately send single cumulative
A7, A7ing both inorder segments
immediately send duplicate ACK,
indicating se3. 1 of net epected byte
immediate send A7, provided that
segment starts at lo!er end of gap
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
18/54
TransportLayer 3-1
TC) +astretransmit time-out period
o+ten relati#elylon%& lon% delay e+ore
resendin% lostpac7et
detect lostse%ments #iaduplicate ACKs" sender o+ten sends
many se%mentsac7-to-ac7
i+ se%ment is lost,
i+ sender recei#es3 ACKs +or same
data8:triple duplicateACKs;9,resendunac7ed se%ment.ith smallest se> li7ely that unac7ed
se%ment lost, sodon@t .ait +or
timeout
TCP fast retransmit
8:triple duplicateACKs;9,
+
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
19/54
TransportLayer 3-12
D
+ast retransmit a+ter sender
receipt o+ triple duplicate ACK
Eost FEost A
5e>2, ytes o+ data
A7
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
20/54
TransportLayer 3-!
Chapter 3 outline
3"1 transport-layerser#ices
3" multiple$in%
anddemultiple$in%
3"3 connectionlesstransport& '()
3"* principles o+reliale datatrans+er
3.5 connection-oriented
transport: TCP
se%ment structure
reliale datatrans+er
o. control
connection
mana%ement3.6 principles of congestion
control
3.7 TCP congestion control
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
21/54
TransportLayer 3-1
TC) o. controlapplication
process
TC) soc7etrecei#er u=ers
TC)code
)code
application
/5
recei#er protocol stac7
application mayremo#e data +rom
TC) soc7et u=ers "
slo.er than TC)recei#er is
deli#erin%8sender issendin%9
+rom sender
recei#er controls sender,so sender .on@t o#ero.recei#er@s u=er ytransmittin% too much,too +ast
ow control
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
22/54
TransportLayer 3-
TC) o. control
u=ered data
+ree u=er space%$d
Rcv"e%
TCP segment paloads
to application process
recei%er 'ad%ertises( free
b"ffer space b& incl"ding
recei%e window *%$d+
%al"e in TCP header of
recei%er-to-sender segments Rcv"e% sie set #ia
soc7et options 8typicalde+ault is *!26 ytes9
many operatin% systems
autoadHust Rcv"e%
sender limits amo"nt of
"nac)ed *'in-flight(+ data to
recei%ers %$d %al"e
g"arantees recei%e b"ffer
receiver!side bu"ering
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
23/54
TransportLayer 3-3
Chapter 3 outline
3"1 transport-layerser#ices
3" multiple$in%
anddemultiple$in%
3"3 connectionlesstransport& '()
3"* principles o+reliale datatrans+er
3.5 connection-oriented
transport: TCP
se%ment structure
reliale datatrans+er
o. control
connection
mana%ement3.6 principles of congestion
control
3.7 TCP congestion control
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
24/54
TransportLayer 3-*
Connection Mana%ement
e+ore e$chan%in% data, senderNrecei#er
:handsha7e;& a%ree to estalish connection 8each 7no.in% the
other .illin% to estalish connection9 a%ree on connection parameters
connection state&I5TAFconnection #ariales&
se> client-to-ser#er
ser#er-to-client%cv"e%sie at ser#er,client
application
net.or7
connection state&I5TAFconnection Oariales&
se> client-to-ser#er
ser#er-to-client%cv"e%sie at ser#er,client
application
net.or7
S!cet clie$tS!cet =
$eS!cet(!st$ame,p!%t
$"me%)/
S!cet c!$$ecti!$S!cet =
elc!meS!cet.accept()/
A i t t li h
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
25/54
TransportLayer 3-4
#:.ill -.ayhandsha7e al.ays.or7 in net.or7G
#ariale delays retransmitted
messa%es 8e"%"re>Pconn8$99 due to
messa%e loss messa%e reorderin% can@t :see; other side
-.ay handsha7e&
Let@s tal7
/K
I5TAF
I5TAF
choose $ re>Pconn8$9
I5TAF
I5TAFaccPconn8$9
A%reein% to estalish aconnection
A i t t li h
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
26/54
TransportLayer 3-6
A%reein% to estalish aconnection
-.ay handsha7e +ailure scenarios&
retransmitre>Pconn8
$9
I5TAF
re>Pconn8$9
hal+ open connectionQ8no clientQ9
clientterminates
ser#er+or%ets $
connection
$ completes
retransmitre>Pconn8
$9
I5TAF
re>Pconn8$9
data8$19
retransmitdata8$19
acceptdata8$1
9
choose $re>Pconn8$9
I5TAF
I5TAF
accPconn8$9
clientterminat
es
I5TAF
choose $re>Pconn8$9
I5TAF
accPconn8$9
data8$19 acceptdata8$19
connection
$ completes ser#er+or%ets $
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
27/54
TransportLayer 3-
TC) 3-.ay handsha7e
5Sit1, 5e>$
choose init se> num, $send TC) 5S ms%
I5TAF
5Sit1, 5e>yACKit1U ACKnum$1
choose init se> num, y
send TC) 5SACKms%, ac7in% 5S
ACKit1, ACKnumy1
recei#ed 5SACK8$9indicates ser#er is li#eUsend ACK +or 5SACKU
this se%ment may containclient-to-ser#er data
recei#ed ACK8y9indicates client is li#e
5S5IT
I5TAF
5S RCO(
client state
L5TI
server state
L5TI
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
28/54
TransportLayer 3-
TC)& closin% a connection
client, ser%er each close their side of connection send TC) se%ment .ith 0 it 1
respond to recei%ed / with #C$
on recei#in% 0, ACK can e comined .ith
o.n 0
sim"ltaneo"s / e0changes can be handled
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
29/54
TransportLayer 3-2
0PWATP
CL/5IPWAT
0it1, se>y
ACKit1U ACKnumy1
ACKit1U ACKnum$1.ait +or ser#erclose
can stillsend data
can no lon%ersend data
LA5TPACK
CL/5I(
TMI(PWAT
timed .ait+or $can no lon%ersend ut canrecei#e data
clientSocket.close()
client stateserver state
I5TAFI5TAF
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
30/54
TransportLayer 3-3!
Chapter 3 outline
3"1 transport-layerser#ices
3" multiple$in%
anddemultiple$in%
3"3 connectionlesstransport& '()
3"* principles o+reliale datatrans+er
3.5 connection-oriented
transport: TCP
se%ment structure
reliale datatrans+er
o. control
connection
mana%ement3.6 principles of congestion
control
3.7 TCP congestion control
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
31/54
TransportLayer 3-31
congestion& in+ormally& :too many sources sendin%
too much data too +ast +or networkto
handle; di=erent +rom o. controlQ mani+estations&
lost pac7ets 8u=er o#ero. atrouters9
lon% delays 8>ueuein% in routeru=ers9
a top-1! prolemQ
)rinciples o+ con%estioncontrol
CausesNcosts o+ con%estion&
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
32/54
TransportLayer 3-3
CausesNcosts o+ con%estion&
scenario 1
t.o senders, t.orecei#ers
one router, in?niteu=ers
output lin7 capacity&
R no retransmission
ma0im"m per-connection
thro"ghp"t: 12
unlimited shared
output link buffers
8ost A
original data: in
8ost E
throughput:out
RN
RN
o
ut
in RN
delay
in
lar%e delays as arri#alrate, in, approaches
capacity
CausesNcosts o+ con%estion&
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
33/54
TransportLayer 3-33
one router, $niteu=ers sender retransmission o+ timed-out
pac7et application-layer input application-layer
output&
in ueue are dropped, luethrou%hput % !
CausesNcosts o+ con%estion&
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
40/54
TransportLayer 3-*!
another :cost; o+ con%estion& .hen pac7et dropped, any :upstream
transmission capacity used +or thatpac7et .as .astedQ
CausesNcosts o+ con%estion&
scenario 3
CN
CN
out
in
A h t d ti
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
41/54
TransportLayer 3-*1
Approaches to.ards con%estioncontrol
t.o road approaches to.ards con%estioncontrol&
end-end
con%estioncontrol& no e$plicit
+eedac7 +romnet.or7
con%estionin+erred +romend-systemoser#ed loss,
delay
networ)-assisted
congestion control: ro"ters pro%ide feedbac)to end s&stems
sin%le itindicatin%con%estion 85A,(ICit, TC)N)IC, ATM9
e$plicit rate +or
sender to send at< ATM& Asynchronous Trans+er Mode
C t d ATM AFR ti
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
42/54
TransportLayer 3-*
Case study& ATM AFR con%estioncontrol
AFR& a#ailale itrate&
:elastic ser#ice;
i+ sender@s path:underloaded;&
sender shoulduse a#ailaleand.idth
i+ sender@s pathcon%ested&
sender throttledto minimum%uaranteed rate
*reso"rce management+
cells: sent b& sender, interspersed
with data cells bits in cell set b&
switches *'network-assisted+
N% bit:no increase inrate 8mildcon%estion9
C% bit:con%estionindication
cells ret"rned to sender
b& recei%er, with bits intact
Case study& ATM AFR con%estion
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
43/54
TransportLayer 3-*3
Case study& ATM AFR con%estioncontrol
t.o-yte IR 8e$plicit rate9 ?eld in RM cell con%ested s.itch may lo.er IR #alue in cell
senders@ send rate thus ma$ supportale rateon path
I0C it in data cells& set to 1 incon%ested s.itch i+ data cell recedin RM cell has I0C set,
RM cell data cell
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
44/54
TransportLayer 3-**
Chapter 3 outline
3"1 transport-layerser#ices
3" multiple$in%
anddemultiple$in%
3"3 connectionlesstransport& '()
3"* principles o+reliale datatrans+er
3.5 connection-oriented
transport: TCP
se%ment structure
reliale datatrans+er
o. control
connection
mana%ement3.6 principles of congestion
control
3.7 TCP congestion control
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
45/54
TransportLayer 3-*4
TC) con%estion control& additi#eincrease multiplicati#e decrease
approach:senderincreases transmissionrate 8.indo. sie9, proin% +or usaleand.idth, until loss occurs additive increase:increase c$dy 1
M55 e#ery RTT until loss detectedmultiplicative decrease&cut c$d in hal+a+ter loss
c($d0
T7se
nder
congestion!indo!
siGe
A#H; sa! tooth
behavior: probingfor band!idth
additi#ely increase .indo. sie " until loss occurs 8then cut .indo. in hal+9
time
M(& Additi#e ncrease, Multiplicati#e (ecrease
TC) Con%estion Control&
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
46/54
TransportLayer 3-*6
TC) Con%estion Control&details
sender limitstransmission&
c$dis dynamic,
+unction o+ percei#ed
TCP sending rate: roughly:send cwnd
b&tes, wait TT for
#C$4, then sendmore b&tes
last yteACKed sent, not-
yetACKed8:in-i%ht;9
last yte
sent
c$d
astyteSe$t-
astyteced
< c$d
sender sequence number space
rateVVc.nd
RTTytesNsec
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
47/54
TransportLayer 3-*
TC) 5lo. 5tart
.hen connectione%ins, increaserate e$ponentiallyuntil ?rst loss e#ent&
initially c$d 1 M55 doule c$de#ery
RTT
done y incrementin%c$d+or e#ery ACKrecei#ed
summar: initial rateis slo. ut ramps upe$ onentiall +ast
8ost A
onesegment
*TT
8ost E
time
t!osegments
foursegments
TC) detectin% reactin% to
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
48/54
TransportLayer 3-*
TC)& detectin%, reactin% toloss loss indicated y timeout& c$dset to 1 M55U
.indo. then %ro.s e$ponentially 8as in
slo. start9 to threshold, then %ro.slinearly
loss indicated y 3 duplicate ACKs&TC)
RI/dup ACKs indicate net.or7 capale o+deli#erin% some se%ments
c$dis cut in hal+ .indo. then %ro.s
linearly
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
49/54
TransportLayer 3-*2
TC) throu%hput
a#%" TC) throu%hput as +unction o+ .indo.sie, RTTG i%nore slo. start, assume al.ays data to send
W& .indo. sie 8measured in ytes9.here loss
occurs a#%" .indo. sie 8 in-i%ht ytes9 is W
a#%" throu%hput is 3N*W per RTTW
WN
a#% TC) throu%hput 3*
WRTT
ytesNsec
TC) 0 t TC) :l + t
-
7/24/2019 Kuliah_06 - Transport Layer (TCP)
50/54
TransportLayer 3-4!
TC) 0utures& TC) o#er :lon%, +atpipes;
e$ample& 14!! yte se%ments, 1!!msRTT, .ant 1! Xps throu%hput
re>uires W 3,333 in-i%ht se%ments
throu%hput in terms o+ se%ment lossproaility, L Mathis 122&
to achie#e 1! Xps throu%hput, need a lossrate o+ L Y1!-1! ( a ver small loss rate)
ne. #ersions o+ TC) +or hi%h-speed
T7 throughput