Tcp
-
Upload
alolmanioop -
Category
Documents
-
view
214 -
download
0
description
Transcript of Tcp
![Page 1: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/1.jpg)
King Saud University - Dr Ahmad Al-Zubi 1
COM210: Computer Networks (CN)COM210: Computer Networks (CN)
Chapter 3: TCPDr Ahmad Al-Zubi
Chapter 3: TCPDr Ahmad Al-Zubi
![Page 2: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/2.jpg)
King Saud University - Dr Ahmad Al-Zubi 2
TCP: Overview
• Point-to-point:– one sender, one receiver
• Reliable, in-order byte steam:– no “message boundaries”– But TCP chops it up into segments for
transmission internally
• Pipelined (window) flow control:– Window size decided by receiver and network
• Send & receive buffers
![Page 3: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/3.jpg)
King Saud University - Dr Ahmad Al-Zubi 3
TCP: Overview
socketdoor
T C Psend buffer
T C Preceive buffer
socketdoor
segm ent
applicationwrites data
applicationreads data
![Page 4: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/4.jpg)
King Saud University - Dr Ahmad Al-Zubi 4
TCP: Overview
• 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 & Congestion Control:– sender will not overwhelm receiver or the
network
![Page 5: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/5.jpg)
King Saud University - Dr Ahmad Al-Zubi 5
TCP segment structure
source port # dest port #
32 bits
applicationdata
(variable length)
sequence number
acknowledgement number
rcvr window size
ptr urgent datachecksum
FSRPAUheadlen
notused
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 willingto accept
countingby bytes of data(not segments!)
Internetchecksum
(as in UDP)
![Page 6: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/6.jpg)
King Saud University - Dr Ahmad Al-Zubi 6
TCP seq. #’s and ACKs (I)Sequence Numbers:
– 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
![Page 7: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/7.jpg)
King Saud University - Dr Ahmad Al-Zubi 7
Host A Host B
Seq=42, ACK=79, data = ‘C’
Seq=79, ACK=43, data = ‘C’
Seq=43, ACK=80
Usertypes
‘C’
host ACKsreceipt
of echoed‘C’
host ACKsreceipt of
‘C’, echoesback ‘C’
simple telnet scenario
TCP Seq. #’s and ACKs (II)
![Page 8: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/8.jpg)
King Saud University - Dr Ahmad Al-Zubi 8
Temporal Redundancy ModelPackets • Sequence Numbers
• CRC or Checksum
Status Reports • ACKs• NAKs, • SACKs• Bitmaps
• Packets• FEC information
Retransmissions
Timeout
![Page 9: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/9.jpg)
King Saud University - Dr Ahmad Al-Zubi 9
Status Report Design
• Cumulative acks: – Robust to losses on the reverse channel– Can work with go-back-N retransmission– Cannot pinpoint blocks of data which are
lost • The first lost packet can be pinpointed
because the receiver would generate duplicate acks
![Page 10: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/10.jpg)
King Saud University - Dr Ahmad Al-Zubi 10
TCP: reliable data transfer (I)
waitfor
event
waitfor
event
event: data received from application above
event: timer timeout for segment with seq # y
event: ACK received,with ACK # y
create, send segment
retransmit segment
ACK processing
• one way data transfer
• no flow, congestion control
![Page 11: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/11.jpg)
King Saud University - Dr Ahmad Al-Zubi 11
TCP: reliable
data transfer (II)
00 sendbase = initial_sequence number 01 nextseqnum = initial_sequence number 0203 loop (forever) { 04 switch(event) 05 event: data received from application above 06 create TCP segment with sequence number nextseqnum 07 start timer for segment nextseqnum 08 pass segment to IP 09 nextseqnum = nextseqnum + length(data) 10 event: timer timeout for segment with sequence number y 11 retransmit segment with sequence number y 12 compute new timeout interval for segment y 13 restart timer for sequence number y 14 event: ACK received, with ACK field value of y 15 if (y > sendbase) { /* cumulative ACK of all data up to y */ 16 cancel all timers for segments with sequence numbers < y 17 sendbase = y 18 } 19 else { /* a duplicate ACK for already ACKed segment */ 20 increment number of duplicate ACKs received for y 21 if (number of duplicate ACKS received for y == 3) { 22 /* TCP fast retransmit */ 23 resend segment with sequence number y 24 restart timer for segment y 25 } 26 } /* end of loop forever */
SimplifiedTCPsender
![Page 12: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/12.jpg)
King Saud University - Dr Ahmad Al-Zubi 12
TCP ACK generation
Event
in-order segment arrival, no gaps,everything else already ACKed
in-order segment arrival, no gaps,one delayed ACK pending
out-of-order segment arrivalhigher-than-expect seq. #gap detected!
arrival of segment that partially or completely fills gap
TCP Receiver action
delayed ACK. Wait up to 500msfor next segment. If no next segment,send ACK
immediately send singlecumulative ACK
send duplicate ACK, indicating seq. #of next expected byte
immediate ACK if segment startsat lower end of gap
![Page 13: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/13.jpg)
King Saud University - Dr Ahmad Al-Zubi 13
TCP: retransmission scenarios
Host A
Seq=92, 8 bytes data
ACK=100
losstim
eou
t
time lost ACK scenario
Host B
X
Seq=92, 8 bytes data
ACK=100
Host A
Seq=100, 20 bytes data
ACK=100
Seq
=92 t
imeou
ttime premature timeout,
cumulative ACKs
Host B
Seq=92, 8 bytes data
ACK=120
Seq=92, 8 bytes data
Seq
=100 t
imeou
t
ACK=120
![Page 14: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/14.jpg)
King Saud University - Dr Ahmad Al-Zubi 14
TCP Flow Controlreceiver: explicitly
informs sender of free buffer space – RcvWindow
field in TCP segment
sender: keeps the amount of transmitted, unACKed data less than most recently received RcvWindow
sender won’t overrunreceiver’s buffers by
transmitting too much, too fast
flow control
receiver buffering
RcvBuffer = size or TCP Receive Buffer
RcvWindow = amount of spare room in Buffer
![Page 15: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/15.jpg)
King Saud University - Dr Ahmad Al-Zubi 15
Timeout and RTT Estimation
• Timeout: for robust detection of packet loss
• Problem: How long should timeout be ?– Too long => underutilization
– Too short => wasteful retransmissions
– Solution: adaptive timeout: based on estimate of max RTT
![Page 16: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/16.jpg)
King Saud University - Dr Ahmad Al-Zubi 16
How to estimate max RTT?• RTT = prop + queuing delay
– Queuing delay highly variable– So, different samples of RTTs will give
different random values of queuing delay
• Chebyshev’s Theorem: – MaxRTT = Avg RTT + k*Deviation– Error probability is less than 1/(k**2)– Result true for ANY distribution of
samples
![Page 17: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/17.jpg)
King Saud University - Dr Ahmad Al-Zubi 17
Q: how to estimate RTT?• SampleRTT: measured time from segment
transmission until ACK receipt– ignore retransmissions, cumulatively
ACKed segments• SampleRTT will vary wildly => want
estimated RTT “smoother”– use several recent measurements, not
just current SampleRTT to calculate “AverageRTT”
Round Trip Time and Timeout (II)
![Page 18: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/18.jpg)
King Saud University - Dr Ahmad Al-Zubi 18
AverageRTT = (1-x)*AverageRTT + x*SampleRTT
• Exponential weighted moving average (EWMA)• influence of given sample decreases
exponentially fast; x = 0.1
Setting the timeout
• AverageRTT plus “safety margin” proportional to variation
Timeout = AverageRTT + 4*Deviation
Deviation = (1-x)*Deviation + x*|SampleRTT- AverageRTT|
TCP Round Trip Time and Timeout (III)
![Page 19: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/19.jpg)
King Saud University - Dr Ahmad Al-Zubi 19
TCP Connection Management - 1 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();
![Page 20: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/20.jpg)
King Saud University - Dr Ahmad Al-Zubi 20
TCP Connection Management - 2Three way handshake:
Step 1: client end system sends TCP SYN control segment to server– specifies initial seq #
Step 2: server end system receives SYN, replies with SYNACK control segment
– ACKs received SYN– allocates buffers– specifies server-> receiver initial seq. #
![Page 21: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/21.jpg)
King Saud University - Dr Ahmad Al-Zubi 21
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.
TCP Connection Management - 3
![Page 22: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/22.jpg)
King Saud University - Dr Ahmad Al-Zubi 22
Fddfdf
d
client
FIN
server
ACK
ACK
FIN
close
close
closed
tim
ed w
ait
TCP Connection Management - 4
![Page 23: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/23.jpg)
King Saud University - Dr Ahmad Al-Zubi 23
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.
TCP Connection Management - 5
![Page 24: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/24.jpg)
King Saud University - Dr Ahmad Al-Zubi 24
TCP client lifecycle
TCP Connection Management - 6
![Page 25: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/25.jpg)
King Saud University - Dr Ahmad Al-Zubi 25
TCP server lifecycle
TCP Connection Management - 7
![Page 26: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/26.jpg)
King Saud University - Dr Ahmad Al-Zubi 26
Recap: Stability of a Multiplexed System
Average Input Rate > Average Output Rate => system is unstable!
How to ensure stability ?1. Reserve enough capacity so that
demand is less than reserved capacity 2. Dynamically detect overload and adapt
either the demand or capacity to resolve overload
![Page 27: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/27.jpg)
King Saud University - Dr Ahmad Al-Zubi 27
Congestion Problem in Packet Switching
A
B
C10 MbsEthernet
1.5 Mbs
45 Mbs
D E
statistical multiplexing
queue of packetswaiting for output
link
Cost: self-descriptive header per-packet, buffering and delays for applications.
Need to either reserve resources or dynamically detect/adapt to overload for stability
![Page 28: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/28.jpg)
King Saud University - Dr Ahmad Al-Zubi 28
i
i
• If information about i , and is known in a central location where control of i or can be effected with zero time delays,– the congestion problem is solved!
The Congestion Problem
1
n
CapacityDemand
•Problem: demand outstrips available capacity
![Page 29: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/29.jpg)
King Saud University - Dr Ahmad Al-Zubi 29
The Congestion Problem (Continued)
• Problems: – Incomplete information (eg: loss
indications)– Distributed solution required– Congestion and
control/measurement locations different
– Time-varying, heterogeneous time-delay
![Page 30: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/30.jpg)
King Saud University - Dr Ahmad Al-Zubi 30
The Congestion Problem• Static fixes may not solve congestion
– a) Memory becomes cheap (infinite memory)
No buffer Too late
All links 19.2 kb/s Replace with 1 Mb/s
SS SS SS SS SS SS SS SS
File Transfer Time = 7 hoursFile Transfer time = 5 mins
b) Links become cheap (high speed links)?
![Page 31: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/31.jpg)
King Saud University - Dr Ahmad Al-Zubi 31
A
BSS
C
DScenario: All links 1 Gb/s.
A & B send to C => “high-speed” congestion!! (lose more packets faster!)
The Congestion Problem (Continued)
• c) Processors become cheap (fast routers & switches)
![Page 32: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/32.jpg)
King Saud University - Dr Ahmad Al-Zubi 32
Principles of Congestion Control
Congestion:• informally: “too many sources sending too
much data too fast for network to handle”• different from flow control (receiver overload)!• manifestations:
– lost packets (buffer overflow at routers)– long delays (queuing in router buffers)
• a top-10 problem!
![Page 33: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/33.jpg)
King Saud University - Dr Ahmad Al-Zubi 33
Causes/costs of congestion: scenario 1
• two senders, two receivers
• one router, infinite buffers
• no retransmission
• large delays when congested
• maximum achievable throughput
![Page 34: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/34.jpg)
King Saud University - Dr Ahmad Al-Zubi 34
Causes/costs of congestion: scenario 2
• one router, finite buffers • sender retransmission of lost packet
![Page 35: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/35.jpg)
King Saud University - Dr Ahmad Al-Zubi 35
Causes/costs of congestion: scenario 2 (continued)
“Costs” of congestion: • More work (retrans) for given “goodput”• Unneeded retransmissions: link carries
multiple copies of pkt due to spurious timeouts
![Page 36: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/36.jpg)
King Saud University - Dr Ahmad Al-Zubi 36
Causes/costs of congestion: scenario 3
Another “cost” of congestion: • when packet dropped, any “upstream
transmission capacity used for that packet was wasted!
![Page 37: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/37.jpg)
King Saud University - Dr Ahmad Al-Zubi 37
Approaches towards congestion control - 1
• Two broad approaches towards congestion control:
End-end congestion control:• no explicit feedback from network
• congestion inferred from end-system observed loss, delay
• approach taken by TCP
![Page 38: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/38.jpg)
King Saud University - Dr Ahmad Al-Zubi 38
Approaches towards congestion control - 2
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
![Page 39: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/39.jpg)
King Saud University - Dr Ahmad Al-Zubi 39
TCP congestion control - 1
• end-end control (no network assistance)• transmission rate limited by congestion
window size, Congwin, over segments:
![Page 40: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/40.jpg)
King Saud University - Dr Ahmad Al-Zubi 40
TCP congestion control - 2
• w segments, each with MSS bytes sent in one RTT:
throughput = w * MSS
RTT Bytes/sec
![Page 41: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/41.jpg)
King Saud University - Dr Ahmad Al-Zubi 41
TCP congestion control - 3• “Probing” for usable bandwidth:
– Window flow control: avoid receiver overrun
– Dynamic window congestion control: avoid/control network overrun
• Policy:– Increase Congwin until loss (congestion)– Loss => decrease Congwin, then begin
probing (increasing) again
![Page 42: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/42.jpg)
King Saud University - Dr Ahmad Al-Zubi 42
Additive Increase/Multiplicative Decrease (AIMD) Policy
• For stability: – rate-of-decrease > rate-of-increase– Decrease performed “enough” times as long as congestion exists
• AIMD policy satisfies this condition, provided packet loss is congestion indicator
window
time
![Page 43: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/43.jpg)
King Saud University - Dr Ahmad Al-Zubi 43
Fairness
Fairness goal: if N TCP sessions share same bottleneck link, each should get 1/N of link capacity
TCP connection 1
bottleneckrouter
capacity R
TCP connection 2
![Page 44: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/44.jpg)
King Saud University - Dr Ahmad Al-Zubi 44
Fairness Analysis
![Page 45: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/45.jpg)
King Saud University - Dr Ahmad Al-Zubi 45
AIMD Converges to Fairness
![Page 46: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/46.jpg)
King Saud University - Dr Ahmad Al-Zubi 46
TCP congestion control - 4• TCP uses AIMD policy in “steady state”• Two “phases”
– Transient phase: aka “Slow start”– Steady State: aka “Congestion avoidance”
• Important variables:– Congwin– threshold: defines threshold between two
slow start phase, congestion avoidance phase
![Page 47: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/47.jpg)
King Saud University - Dr Ahmad Al-Zubi 47
TCP Slowstart - 1
• Exponential increase (per RTT) in window size (not so slow!)
• Loss event: timeout (Tahoe TCP) and/or three duplicate ACKs (Reno TCP)
Slowstart algorithm
initialize: Congwin = 1for (each segment ACKed) Congwin++until (loss event OR CongWin > threshold)
![Page 48: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/48.jpg)
King Saud University - Dr Ahmad Al-Zubi 48
TCP Slowstart - 2
• asdf Host A
one segment
RT
T
Host B
time
two segments
four segments
![Page 49: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/49.jpg)
King Saud University - Dr Ahmad Al-Zubi 49
TCP Dynamics
• Rate of acks determines rate of packets : “Self-clocking” property.
100 Mbps 10 Mbps
RouterQ
1st RTT 2nd RTT 3rd RTT 4th RTT
![Page 50: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/50.jpg)
King Saud University - Dr Ahmad Al-Zubi 50
TCP Congestion Avoidance - 1
/* slowstart is over */ /* Congwin > threshold */Until (loss event) { every w segments ACKed: Congwin++ }threshold = Congwin/2Congwin = 1perform slowstart
Congestion avoidance
1
1: TCP Reno skips slowstart (aka fast recovery) after three duplicate ACKs and performs close to AIMD
![Page 51: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/51.jpg)
King Saud University - Dr Ahmad Al-Zubi 51
TCP Congestion Avoidance - 2
![Page 52: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/52.jpg)
King Saud University - Dr Ahmad Al-Zubi 52
TCP window dynamics (more)
Time (units of RTTs)
CongestionWindow (cwnd)
Receiver Window
IdleInterval
Timeout
1
ssthresh
![Page 53: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/53.jpg)
King Saud University - Dr Ahmad Al-Zubi 53
TCP latency modeling - 1
Q: How long does it take to receive an object from a Web server after sending a request?
• TCP connection establishment
• data transfer delay
![Page 54: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/54.jpg)
King Saud University - Dr Ahmad Al-Zubi 54
TCP latency modeling - 2
Notation, assumptions:• Assume one link between client and
server of rate R• Assume: fixed congestion window, W
segments• S: MSS (bits)• O: object size (bits)• no retransmissions (no loss, no
corruption)
![Page 55: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/55.jpg)
King Saud University - Dr Ahmad Al-Zubi 55
TCP latency modeling - 3Two cases to consider:• WS/R > RTT + S/R: ACK for first
segment in window returns before window’s worth of data sent
• WS/R < RTT + S/R: wait for ACK after sending window’s worth of data sent
![Page 56: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/56.jpg)
King Saud University - Dr Ahmad Al-Zubi 56
TCP latency modeling - 4
Case 1: latency = 2RTT + O/R
![Page 57: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/57.jpg)
King Saud University - Dr Ahmad Al-Zubi 57
TCP latency modeling - 5
Case 2: latency = 2RTT + O/R+ (K-1)[S/R + RTT - WS/R]
K = O/WS
![Page 58: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/58.jpg)
King Saud University - Dr Ahmad Al-Zubi 58
TCP latency modeling: slow start - 1
• Now suppose window grows according to slow start.
• Will show that the latency of one object of size O is:
R
S
R
SRTTP
R
ORTTLatency P )12(2
where P is the number of times TCP stalls at server:
![Page 59: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/59.jpg)
King Saud University - Dr Ahmad Al-Zubi 59
- where Q is the number of times the server would stall if the object were of infinite size.
- and K is the number of windows that cover the object.
}1,{min KQP
TCP latency modeling: slow start - 2
![Page 60: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/60.jpg)
King Saud University - Dr Ahmad Al-Zubi 60
Example:
O/S = 15 segments
K = 4 windows
Q = 2
P = min{K-1,Q} = 2
Server stalls P=2 times.
RTT
initia te TCPconnection
requestobject
first w indow= S /R
second w indow= 2S/R
third w indow= 4S/R
fourth w indow= 8S/R
com pletetransm issionobject
delivered
tim e atc lient
tim e atserver
TCP latency modeling: slow start - 3
![Page 61: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/61.jpg)
King Saud University - Dr Ahmad Al-Zubi 61
windowth after the timestall 2 1 kR
SRTT
R
S k
time from when server starts to send segment
until server receives acknowledgement
SRTT
R
window kth the transmit totime2 1
R
Sk
TCP latency modeling: slow start - 4
![Page 62: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/62.jpg)
King Saud University - Dr Ahmad Al-Zubi 62
R
S
R
SRTTPRTT
R
O
R
SRTT
R
SRTT
R
O
stallTimeRTTR
O
P
kP
k
P
pp
)12(][2
]2[2
2latency
1
1
1
TCP latency modeling: slow start - 5
![Page 63: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/63.jpg)
King Saud University - Dr Ahmad Al-Zubi 63
Sample Results
R O/R PMinimum
Latency: O/R + 2 RTT
Latency with slow start
28 Kbps 28.6 sec 1 28.8 sec 28.9 sec
100 Kbps 8 sec 2 8.2 sec 8.4 sec
1 Mbps 800 msec
5 1 sec 1.5 sec
10 Mbps 80 msec 7 0.28 sec 0.98 sec
![Page 64: Tcp](https://reader035.fdocuments.net/reader035/viewer/2022062809/5695d03a1a28ab9b02918cf0/html5/thumbnails/64.jpg)
King Saud University - Dr Ahmad Al-Zubi 64
Summary: Chapter 3
• Principles behind transport layer services:• multiplexing/demultiplexing• reliable data transfer• flow control• congestion control
• Instantiation and implementation in the Internet
• UDP, TCP