Professional Documents
Culture Documents
Transport Layer: Computer Networking: A Top Down Approach
Transport Layer: Computer Networking: A Top Down Approach
Transport Layer: Computer Networking: A Top Down Approach
Transport Layer
network
available:
delay guarantees
bandwidth guarantees
Transport Layer 3-6
Chapter 3 outline
3.1 transport-layer 3.5 connection-oriented
services transport: TCP
3.2 multiplexing and segment structure
demultiplexing reliable data transfer
3.3 connectionless flow control
transport: UDP connection
management
3.4 principles of
reliable data 3.6 principles of
transfer congestion control
3.7 TCP congestion
control
application
length checksum
why is there a UDP?
no connection
application establishment (which
data can add delay)
(payload) simple: no connection
state at sender, receiver
small header size
UDP segment format no congestion control:
UDP can blast away as
fast as desired
wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
send receive
side side
sender receiver
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
U L/R .008
sender = = = 0.00027
RTT + L / R 30.008
U 3L / R .0024
sender = = = 0.00081
RTT + L / R 30.008
User
types
‘C’ Seq=42, ACK=79, data = ‘C’
host ACKs
receipt of
‘C’, echoes
Seq=79, ACK=43, data = ‘C’ back ‘C’
host ACKs
receipt
of echoed
‘C’ Seq=43, ACK=80
300
250
RTT (milliseconds)
200
sampleRTT
150
EstimatedRTT
100
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
time (seconds) Transport Layer 3-62
SampleRTT Estimated RTT
TCP round trip time, timeout
timeout interval: EstimatedRTT plus “safety
margin”
large variation in EstimatedRTT -> larger safety margin
estimate
DevRTT SampleRTT deviation
= (1-)*DevRTT + from EstimatedRTT:
*|SampleRTT-EstimatedRTT|
(typically, = 0.25)
SendBase=92
Seq=92, 8 bytes of data Seq=92, 8 bytes of data
timeout
ACK=100
X
ACK=100
ACK=120
SendBase=120
ACK=100
X
ACK=120
cumulative ACK
Transport Layer 3-69
TCP ACK generation [RFC 1122, RFC 2581]
ACK=100
timeout
ACK=100
ACK=100
ACK=100
Seq=100, 20 bytes of data
IP
flow control code
receiver controls sender, so
sender won’t overflow
receiver’s buffer by from sender
transmitting too much, too fast
receiver protocol stack
network network
2-way handshake:
Q: will 2-way
handshake always
Let’s talk
work in network?
ESTAB variable delays
OK
ESTAB retransmitted messages
(e.g. req_conn(x)) due to
message loss
message reordering
choose x
req_conn(x)
can’t “see” other side
ESTAB
acc_conn(x)
ESTAB
choose x choose x
req_conn(x) req_conn(x)
ESTAB ESTAB
retransmit acc_conn(x) retransmit acc_conn(x)
req_conn(x) req_conn(x)
ESTAB ESTAB
data(x+1) accept
req_conn(x)
retransmit data(x+1)
data(x+1)
connection connection
client x completes server x completes server
client
terminates forgets x terminates forgets x
req_conn(x)
ESTAB ESTAB
data(x+1) accept
half open connection! data(x+1)
(no client!)
Transport Layer 3-79
TCP 3-way handshake
Socket connectionSocket =
welcomeSocket.accept();
L Socket clientSocket =
SYN(x) newSocket("hostname","port
number");
SYNACK(seq=y,ACKnum=x+1)
create new socket for SYN(seq=x)
communication back to client listen
SYN SYN
rcvd sent
SYNACK(seq=y,ACKnum=x+1)
ESTAB ACK(ACKnum=y+1)
ACK(ACKnum=y+1)
L
LAST_ACK
FINbit=1, seq=y
TIMED_WAIT can no longer
send data
ACKbit=1; ACKnum=y+1
timed wait
for 2*max CLOSED
segment lifetime
CLOSED
R/2
delay
lout
Host A
lout
sender sends only
when router buffers
available lin R/2
A
no buffer space!
Host B
Transport Layer 3-89
Causes/costs of congestion: scenario
2
Idealization: known R/2
loss packets can be when sending at R/2,
lost, dropped at router some packets are
lout
due to full buffers retransmissions but
asymptotic goodput
sender only resends if is still R/2 (why?)
packet known to be lin R/2
lost
lin : original data
lout
l'in: original data, plus
retransmitted data
A
free buffer space!
Host B
Transport Layer 3-90
Causes/costs of congestion: scenario
2
Realistic: duplicates R/2
packets can be lost,
when sending at R/2,
dropped at router due to some packets are
lout
full buffers retransmissions
including duplicated
sender times out that are delivered!
prematurely, sending two lin R/2
copies, both of which are
delivered lin
timeout
copy l'in lout
A
free buffer space!
Host B
Transport Layer 3-91
Causes/costs of congestion: scenario
2
Realistic: duplicates R/2
packets can be lost,
when sending at R/2,
dropped at router due to some packets are
lout
full buffers retransmissions
including duplicated
sender times out that are delivered!
prematurely, sending two lin R/2
copies, both of which are
delivered
“costs” of congestion:
more work (retrans) for given “goodput”
unneeded retransmissions: link carries multiple copies
of pkt
decreasing goodput
Host D
Host C
lin’ C/2
end-end network-assisted
congestion congestion control:
control: routers provide
no explicit feedback feedback to end
from network systems
congestion inferred single bit indicating
from end-system congestion (SNA,
observed loss, DECbit, TCP/IP
delay ECN, ATM)
approach taken by explicit rate for
TCP sender to send at
Transport Layer 3-95
Case study: ATM ABR congestion
control
ABR: available bit RM (resource
rate: management) cells:
“elastic service” sent by sender,
if sender’s path interspersed with data cells
“underloaded”: bits in RM cell set by
sender should use switches (“network-
available bandwidth assisted”)
if sender’s path NI bit: no increase in
congested: rate (mild congestion)
sender throttled to CI bit: congestion
minimum indication
guaranteed rate RM cells returned to
sender by receiver, with
bits intact
Transport Layer 3-96
Case study: ATM ABR congestion
control
RM cell data cell
time
Transport Layer 3-99
TCP Congestion Control:
details
sender sequence number space
cwnd TCP sending rate:
roughly: send cwnd
bytes, wait RTT for
last byte last byte
ACKS, then send
ACKed sent, not- sent
yet ACKed more bytes
(“in-
flight”) cwnd
sender limits rate ~
~ bytes/sec
RTT
transmission:
LastByteSent- < cwnd
LastByteAcked
cwnd is dynamic,
function of perceived
network congestion Transport Layer 3-100
TCP Slow Start
Host A Host B
when connection
begins, increase rate
exponentially until first
RTT
loss event:
initially cwnd = 1 MSS
double cwnd every RTT
done by incrementing
cwnd for every ACK
received
summary: initial rate is
slow but ramps up
exponentially fast time
W/2
TCP connection 1
bottleneck
router
capacity R
TCP connection 2
Connection 1 throughput R
Transport Layer 3-108
Fairness (more)
Fairness and UDP Fairness, parallel TCP
multimedia apps connections
often do not use application can open
TCP multiple parallel
do not want rate connections between two
throttled by hosts
congestion control
web browsers do this
instead use UDP:
send audio/video at e.g., link of rate R with 9
constant rate, existing connections:
tolerate packet loss new app asks for 1 TCP, gets
rate R/10
new app asks for 11 TCPs, gets
R/2