Download TCP Congestion Control: Impact of Congestion on Networks and TCP's Solution and more Study notes Computer Systems Networking and Telecommunications in PDF only on Docsity!
EEC 189Q:
Computer Networks
TCP: Examples
Causes/Costs of Congestion
TCP Congestion Control
Reading: 7.8.
Chuah, Fall 2004 2
Example 1: Client Server Application
Host A (Client) Host B (Server)
SYN, Seq_no = x
SYN, Seq_no = y, ACK, Ack_no = x+
Seq_no = x+1, ACK, Ack_no = y+
Revisit connection establishment process
[Leon-Garcia] Pg. 578-
Chuah, Fall 2004 3
Example 1 (Cont’d)
Host A (Client) Host B (Server)
SYN, Seq_no = x
SYN, Seq_no = y, ACK, Ack_no = x+ Seq_no = x+1, ACK, Ack_no = y+
socket bind listen accept
socket connect
connect returns
accept returns read
write read
read returns
write read read returns
request message
reply message
Passive Open/ Advertise
Chuah, Fall 2004 4
Example 2: TCP Window Flow Control
Host A Host B
Seq_no = 2000, Ack_no = 1, Win = 1024, Data = 2000-
Seq_no = 1, Ack_no = 4048, Win = 512, Data = 1-
Seq_no = 3024, Ack_no = 1, Win = 1024, Data = 3024-
Seq_no = 4048, Ack_no = 129, Win = 1024, Data = 4048-
t 1
t 2
t 3
t 4
Seq_no = 1, Ack_no = 2000, Win = 2048, No Data t 0
Chuah, Fall 2004 7
Causes/Costs of Congestion: Scenario I
ß Two senders, two
receivers
ß One router, infinite
buffers
ß No retransmission
ß Large delays when
congested
ß Maximum achievable
throughput
Chuah, Fall 2004 8
Causes/Costs of Congestion: Scenario II
ß One router, finite buffers
ß Sender retransmission of lost packet
Chuah, Fall 2004 9
Q: what happens as and
increase?
Causes/Costs of Congestion: Scenario III
ß Four senders
ß Multihop paths
ß Timeout/retransmit
in
in
λin : original data λ'in : original data, plus retransmitted data
Chuah, Fall 2004 10
Another “cost” of congestion:
ß When packet dropped, any “upstream” transmission capacity
used for that packet was wasted!
Causes/Costs of Congestion: Scenario III
Chuah, Fall 2004 13
Congestion Avoidance vs. Control
Two ways to combat congestion
ß Preventive (avoidance)
- Hosts and routers attempt to prevent congestion before
it can occur
ß Reactive (control)
- The hosts and routers respond to congestion after it
occurs and then attempt to stop it
Chuah, Fall 2004 14
Taxonomy of Congestion Control
ß Open-Loop
- Make sure congestion doesn’t occur
- Design and provision the network to avoid congestion
ß Closed-Loop
- Monitor, detect and react to congestion
- Based on the concept of feedback loop
ß Hybrid
- Avoidance at a slower time scale
- Reaction at a faster time scale
Chuah, Fall 2004 15
Closed-Loop Congestion Control
ß Router-Centric vs Host-Centric
- Router-centric: congestion control inside the network
- Host-centric: congestion control by the end hosts
ß Explicit vs Implicit
- Explicit: congested router tells source to slow down
- Implicit: source infers congestion by observing
network
ß Window-based vs Rate-based
- Window-based: no. of packets sent limited by a
window
- Rate-based: packets to be sent controlled by a rate
Chuah, Fall 2004 16
TCP Approach
ß Window-based, implicit, host-centric
ß Idea
- Each source determines network capacity for itself
- Uses implicit feedback, adaptive congestion window
- ACKs pace transmission (self-clocking)
ß Challenge
- Determining the available capacity in the first place
- Adjusting to changes in the available capacity
Chuah, Fall 2004 19
TCP Congestion Control
ß Two “phases”
- Slow start and Congestion avoidance
ß Important variables:
- Congwin
- Threshold: defines threshold between slow start and
congestion avoidance phases
ß “Probing” for usable bandwidth:
- Ideally: transmit as fast as possible ( Congwin as large as
possible) without loss
- Increase Congwin until loss (congestion)
- Loss: decrease Congwin , then begin probing (increasing) again
Chuah, Fall 2004 20
Why Slow Start?
ß Objective
- Determine the available capacity in the first place
ß Idea
- Begin with congestion window = 1 pkt
- Double congestion window each RTT
ß Exponential growth but slower than one blast
ß Used when
- First starting connection
- Connection goes dead waiting for a timeout
Chuah, Fall 2004 21
TCP Slowstart
ß Exponential increase (per RTT) in window size (not so slow!) ß Loss event: timeout (Tahoe TCP) and/or or three duplicate ACKs (Reno TCP)
initialize: Congwin = 1
for (each segment ACKed)
Congwin*
until (loss event OR
CongWin > threshold)
Slowstart algorithm
Host A
one segment
RTT
Host B
time
two segments
four segments
Chuah, Fall 2004 22
TCP Congestion Avoidance
/* slowstart is over */
/* Congwin > threshold */
Until (loss event) {
every w segments ACKed:
Congwin++
threshold = Congwin/
Congwin = 1
perform slowstart
Congestion avoidance
Chuah, Fall 2004 25
Congestion Avoidance
ß TCP’s strategy
- Control congestion once it happens
- Repeatedly increase load in an effort to find the point at which congestion occurs, and then back off
ß Alternative strategy
- predict when congestion is about to happen
- reduce rate before packets start being discarded
- congestion avoidance , instead of congestion control
ß Two possibilities
- router-centric: DECbit and RED Gateways
- host-centric: TCP Vegas
Chuah, Fall 2004 26
TCP Fairness
Fairness goal: If N TCP sessions share same bottleneck link, each
should get 1/N of link capacity
TCP connection 1
bottleneck router capacity R
TCP
connection 2
Chuah, Fall 2004 27
Why is TCP fair?
Two competing sessions:
ß Additive increase gives slope of 1, as throughput increases ß multiplicative decrease decreases throughput proportionally
R
R
equal bandwidth share
Connection 1 throughput
Connection 2 throughput
congestion avoidance: additive increase
loss: decrease window by factor of 2
Chuah, Fall 2004 28
Dealing with Greedy Senders
ß Scheduling and dropping policies at routers
ß First-in-first-out (FIFO) with tail drop
- Greedy sender can capture large share of capacity
ß Solutions?
- Fair Queuing
- Separate queue for each flow
- Schedule them in a round-robin fashion
- When a flow’s queue fills up, only its packets are dropped
- Insulates well-behaved from ill-behaved flows
- Random Early Detection (RED)
Chuah, Fall 2004 31
Chuah, Fall 2004 32
TCP latency modeling
Q: How long does it take to receive
an object from a Web server after
sending a request?
ß TCP connection establishment ß data transfer delay
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)
Two 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
Chuah, Fall 2004 33
TCP latency Modeling
Case 1: latency = 2RTT + O/R Case 2: latency = 2RTT + O/R
+ (K-1)[S/R + RTT - WS/R]
K:= O/WS
Chuah, Fall 2004 34
TCP Latency Modeling: Slow Start
ß Now suppose window grows according to slow start. ß Will show that the latency of one object of size O is:
R
S R
S P RTT R
O Latency RTT P (^2) −( 2 − 1 )
= + + +
where P is the number of times TCP stalls at server:
P = min{ Q , K − 1 }
- 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.