0% found this document useful (0 votes)
54 views31 pages

Last Time: UDP Socket Programming

The document discusses TCP congestion control mechanisms including fast retransmit which allows resending a lost segment after 3 duplicate ACKs are received rather than waiting for a timeout, additive increase/multiplicative decrease which probes for available bandwidth by slowly increasing the congestion window size until a loss occurs and then cutting it in half, and slow start which exponentially increases the congestion window size when a connection begins until the first loss event.

Uploaded by

Mona Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views31 pages

Last Time: UDP Socket Programming

The document discusses TCP congestion control mechanisms including fast retransmit which allows resending a lost segment after 3 duplicate ACKs are received rather than waiting for a timeout, additive increase/multiplicative decrease which probes for available bandwidth by slowly increasing the congestion window size until a loss occurs and then cutting it in half, and slow start which exponentially increases the congestion window size when a connection begins until the first loss event.

Uploaded by

Mona Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Last time

UDP socket programming

DatagramSocket, DatagramPacket

TCP

Sequence numbers, ACKs

RTT, DevRTT, timeout calculations

Reliable data transfer algorithm

17-1
This time
TCP

Fast retransmit

Flow control

Connection management

Congestion control

17-2
Fast Retransmit
Time-out period often If sender receives 3
relatively long: ACKs for the same data,
long delay before it supposes that segment
resending lost packet after ACKed data was
Detect lost segments lost:
via duplicate ACKs. fast retransmit: resend
Sender often sends segment before timer
many segments back-to- expires
back
If segment is lost, there
will likely be many
duplicate ACKs.

17-3
Fast retransmit algorithm:

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
}

a duplicate ACK for fast retransmit


already ACKed segment

17-4
Chapter 3 outline
3.1 Transport-layer 3.5 Connection-oriented
services transport: TCP
3.2 Multiplexing and segment structure
demultiplexing reliable data transfer
flow control
3.3 Connectionless
connection management
transport: UDP
3.4 Principles of reliable 3.6 Principles of
data transfer congestion control
3.7 TCP congestion
control

17-5
TCP Flow control: how it works
Rcvr advertises spare
room by including value
of RcvWindow in
segments
Sender limits unACKed
(Suppose TCP receiver data to RcvWindow
discards out-of-order guarantees receive buffer
segments) doesnt overflow
spare room in buffer
= RcvWindow
See the applet in UW-ACE!
= RcvBuffer-[LastByteRcvd -
LastByteRead]

17-7
Chapter 3 outline
3.1 Transport-layer 3.5 Connection-oriented
services transport: TCP
3.2 Multiplexing and segment structure
demultiplexing reliable data transfer
flow control
3.3 Connectionless
connection management
transport: UDP
3.4 Principles of reliable 3.6 Principles of
data transfer congestion control
3.7 TCP congestion
control

17-8
TCP Connection Management
Recall: TCP sender, receiver Three way handshake:
establish connection before
exchanging data segments Step 1: client host sends TCP
initialize TCP variables: SYN segment to server
specifies initial seq #
seq. #s
no data
buffers, flow control info
(e.g. RcvWindow) Step 2: server host receives SYN,
client: connection initiator replies with SYNACK segment
Socket clientSocket = new server allocates buffers
Socket("hostname","port
specifies server initial seq. #
number");
Step 3: client receives SYNACK,
server: contacted by client replies with ACK segment,
Socket connectionSocket =
welcomeSocket.accept();
which may contain data

17-9
TCP Connection Management (cont.)

Step 3: client receives FIN, client server


replies with ACK.
closing
Enters timed wait - will
respond with ACK to
received FINs
closing
Step 4: server, receives ACK.
Connection closed.

Note: with small modification,


timed wait
can handle simultaneous closed
FINs.

closed

17-11
TCP Connection Management (cont)

TCP server
lifecycle

TCP client
lifecycle

17-12
Chapter 3 outline
3.1 Transport-layer 3.5 Connection-oriented
services transport: TCP
3.2 Multiplexing and segment structure
demultiplexing reliable data transfer
flow control
3.3 Connectionless
connection management
transport: UDP
3.4 Principles of reliable 3.6 Principles of
data transfer congestion control
3.7 TCP congestion
control

17-13
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!

17-14
Approaches towards congestion control
Two broad approaches towards congestion control:

End-end congestion Network-assisted


control: congestion control:
no explicit feedback from routers provide feedback to
network end systems
congestion inferred from single bit indicating
end-system observed loss, congestion (SNA,
delay DECbit, TCP/IP ECN,
approach taken by TCP ATM)
explicit rate sender
should send at

17-20
Chapter 3 outline
3.1 Transport-layer 3.5 Connection-oriented
services transport: TCP
3.2 Multiplexing and segment structure
demultiplexing reliable data transfer
flow control
3.3 Connectionless
connection management
transport: UDP
3.4 Principles of reliable 3.6 Principles of
data transfer congestion control
3.7 TCP congestion
control

17-21
TCP congestion control: additive increase,
multiplicative decrease
Approach: increase transmission rate (window size),
probing for usable bandwidth, until loss occurs
additive increase: increase CongWin by 1 MSS every
RTT until loss detected
multiplicative decrease: cut CongWin in half after loss
congestion
window
congestion window size

24 Kbytes

Saw tooth
16 Kbytes
behavior: probing
for bandwidth
8 Kbytes

time
time

17-23
TCP Slow Start
When connection begins, When connection begins,
CongWin = 1 MSS increase rate
Example: MSS = 1 kBytes exponentially fast until
& RTT = 200 msec first loss event
initial rate = 40 kbps
available bandwidth may
be >> MSS/RTT
desirable to quickly ramp
up to respectable rate

17-24
Refinement
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

17-26
Refinement: inferring loss
After 3 dup ACKs:
CongWin is cut in half
Philosophy:
window then grows
linearly 3 dup ACKs indicates
But after timeout event: network capable of
CongWin instead set to
delivering some segments
Timeout indicates a
1 MSS;
more alarming
window then grows congestion scenario
exponentially
to a threshold, then
grows linearly

17-27
Summary: TCP Congestion Control

When CongWin is below Threshold, sender in


slow-start phase, window grows exponentially.
When CongWin is above Threshold, sender is in
congestion-avoidance phase, window grows linearly.
When a triple duplicate ACK occurs, Threshold set
to CongWin/2 and CongWin set to Threshold.
When timeout occurs, Threshold set to CongWin/2
and CongWin is set to 1 MSS.

17-28
Recap
Fast retransmit
3 duplicate ACKs
Flow control
Receiver windows
Connection management
SYN/SYNACK/ACK, FIN/ACK, TCP states
Congestion control
General concepts
TCP congestion control
AIMD, slow start, congestion avoidance

17-30
Next time
TCP

Throughput

Fairness

Delay modeling

TCP socket programming

NAT
17-31

You might also like