congestion control (cont’d). tcp congestion control review congestion control consists of 3 tasks ...

43
Congestion Control (cont’d)

Upload: kenneth-emil-robbins

Post on 02-Jan-2016

241 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Congestion Control (cont’d)

Page 2: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

TCP Congestion Control Review

Congestion control consists of 3 tasks Detect congestion Adjust sending rate Determine available bandwidth

How does TCP do each of these?

Page 3: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Packets vs. Bytes

TCP window sizes are in bytes Congestion control works on packets

Increase by 1 packet every RTT Pcwnd = cwnd / MSS Pcwnd = Pcwnd + 1/Pcwnd on each ACK

Multiply by MSS to get byte-sized formula cwnd = cwnd + MSS*(MSS/cwnd) on each ACK Increase by 1 MSS every RTT

Page 4: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

TCP Start Up

How do we set initial window size? Additive increase too slow Example: DSL line

RTT=100ms, MSS=1500b, BW=200KB/s After 1 RTT, rate is 15 KB/s After 1s, rate is 150 KB/s Takes 8.3s to transfer 500 KB file

Page 5: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Slow Start

Objective Determine initial available capacity

Idea Begin with CongestionWindow = 1

packet Double CongestionWindow each

RTT Increment by 1 packet for each ACK

Continue increasing until loss, then switch to AIMD

Result Exponential growth Slower than all at once

Source Destination

Page 6: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Window rate control

Congestion window ensures average rate is cwnd / RTT Instantaneous rate may be larger

time

0 2 RTT1 RTT

window-controlledtransmissions

rate-controlledtransmissions

Page 7: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

ACK clocking

ACK clocking spreads out bursts Packets sent in a burst arrive spread out ACKs follow the timing of received rate

Sender Router Receiver

100 Mbps 5 Mbps

Page 8: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

ACK clocking

ACK clocking spreads out bursts Packets sent in a burst arrive spread out ACKs follow the timing of received rate New sending rate follows ACK rate

Sender Router Receiver

100 Mbps 5 Mbps

Page 9: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Slow start

ACK clocking, with 2 packets per ACK

Sender Router Receiver

Page 10: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Slow start

ACK clocking, with 2 packets per ACK

Sender Router Receiver

Page 11: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Slow start

ACK clocking, with 2 packets per ACK

Sender Router Receiver

NB: There’s a proposed alternative to slow-start that uses ACK clocking

Page 12: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

TCP Timeoutcwnd

cwnd x

timeout

retransmit

cumulative ack

Page 13: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Timeout Handling

Cumulative ACK opens up entire window Do we send entire window all at once? No ACKs to clock transmission

Use slow-start to recover ACK clock Reset cwnd to 1 (packet) Use exponential increase(add 1 packet to cwnd for every ACK)

Page 14: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Congestion Threshold

New variable: Congestion Threshold Target window size Estimate network capacity

If cwnd < cthresh, increase exponentially slow start

If cwnd > cthresh, increase linearly additive increase

Initially, ctrhesh = max window At loss, ctrhesh = 1/2 cwnd

Page 15: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Slow Start

Initial values cthresh = 8 cwnd = 1

Loss after transmission 7 cwnd currently 12 Set cthresh = cwnd/2 Set cwnd = 1

Page 16: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Slow Start

Example trace of CongestionWindow

60

20

1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0

KB

70

304050

10

Problem Have to wait for timeout Can lose half CongestionWindow of data

CW flattens out due to loss

Slow start until CW = CT

Linear increase

Timeout: CT = CW/2 = 11, CW = 1

Page 17: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Fast Retransmit and Fast Recovery

Problem Coarse-grain TCP

timeouts lead to idle periods

Solution Fast retransmit: use

duplicate ACKs to trigger retransmission

Packet 1Packet 2Packet 3Packet 4

Packet 5

Packet 6

Retransmitpacket 3

ACK 1

ACK 2

ACK 2

ACK 2

ACK 6

ACK 2

Sender Receiver

Page 18: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Fast Retransmit and Fast Recovery

Send ACK for each segment received When duplicate ACK’s received

Resend lost segment immediately Do not wait for timeout In practice, retransmit on 3rd duplicate

Fast recovery When fast retransmission occurs, skip slow start Congestion window becomes 1/2 previous Start additive increase immediately

Page 19: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

TCP Congestion Window Trace

0

10

20

30

40

50

60

70

0 10 20 30 40 50 60

Time

Congestion Window

threshold

congestionwindowtimeouts

slow start period

additive increase

fast retransmission

Page 20: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

TCP Congestion Control Summary

Congestion control mechanisms Timeouts RTT estimation Congestion window Slow start Fast retransmit

Page 21: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Fairness

TCP congestion control is fair Both senders will settle at around 5 Mbps Intuition: flows using more bandwidth

more likely to experience loss

Sender 2

Router

Receiver 120 Mbps 10 Mbps

Sender 1

Receiver 2

Page 22: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

What’s Fair?

Flow A

Flow B Flow C Flow D

Which is more fair:

Globally Fair: Fa = Capacity/4, Fb = Fc = Fd = 3Capacity/4

or

Locally Fair: Fa = Fb = Fc = Fd = Capacity/2

This is the so-called “max-min

fair” rate allocation. The minimum rate is

maximized.

Page 23: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

TCP fairness

TCP is “RTT-fair” On each congested link, host gets shared of

bandwidth proportional to RTT Intuition: during additive increase, each host

adds one new packet every RTT If RTT twice as large, additive increase is half as

fast Is this closer to globally fair or locally fair?

Page 24: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Why is TCP fair?Two competing sessions: Additive increase improves fairness Multiplicative decrease preserves fairness

R

R

equal bandwidth share

Connection 1 throughput

Con

nect

ion

2 th

roug

h pu t

congestion avoidance: additive increaseloss: decrease window by factor of 2

congestion avoidance: additive increaseloss: decrease window by factor of 2

Page 25: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Congestion Avoidance

Control vs. avoidance Control: minimize impact of congestion when it occurs Avoidance: avoid producing congestion

In terms of operating point limits

loadpow

er

optimal load

idealizedpower curve

controlavoidance

Page 26: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Congestion Avoidance

TCP’s strategy Repeatedly cause congestion Control it once it happens

Alternative Strategy Predict when congestion is about to happen and reduce

the rate at which hosts send data just before packets start being discarded

Congestion avoidance, as compared to congestion control Approaches

Routers implement CA (ATM, RSVP) Routers help end-hosts implement CA (DECbit, RED) End-hosts do it themselves (TCP Vegas)

Page 27: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

DECbit (Destination Experiencing Congestion Bit)

Developed for the Digital Network Architecture

Basic idea One bit allocated in packet header Any router experiencing congestion sets bit Source adjusts rate based on bits

Note that responsibility is shared Routers identify congestion Hosts act to avoid congestion

Page 28: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

DECbit

Router Monitors length over last busy + idle cycle Sets congestion bit if average queue length is greater then 1

when packet arrives Attempts to balance throughput against delay

smaller values result in more idle time larger values result in more queueing delay

Que

ue le

ngth

Currenttime

TimeCurrent cyclePrevious cycle

Averaginginterval

Page 29: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

DECbit

End Hosts Destination echoes congestion bit back to source Source records how many packets resulted in set bit If less than 50% of last window had bit set

Increase CongestionWindow by 1 packet If 50% or more of last window had bit set

Decrease CongestionWindow by 1/8th

Note: Techniques used in DECbit known as explicit congestion

notification (ECN) Proposal to add ECN bit to TCP in progress

Page 30: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Router-Based Congestion Avoidance

Random Early Detection (RED) gateways Developed for use with TCP Basic idea

Implicit rather than explicit notification When a router is “almost” congested Drop packets randomly

Responsibility is again shared Router identifies, host acts Relies on TCP’s response to dropped packets

Page 31: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Random Early Detection (RED)

Hosts Implement TCP congestion control Back off when a packet is dropped

Routers Compute average queue length (exponential moving

average) AvgLen = (1 – Weight) * AvgLen + Weight * SampleLen 0 < Weight < 1 (usually 0.002) SampleLen is queue length at packet arrival time

Page 32: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

RED – Dropping Policy

If AvgLen MinThreshold Enqueue packet

If MinThreshold < AvgLen < MaxThreshold Calculate P and drop arriving packet with probability P

If MaxThreshold AvgLen Drop arriving packet

MaxThreshold MinThreshold

AvgLenAvgLen AvgLen

Page 33: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

RED – Dropping Probability

Computing P P is a function of AvgLen and Count Count is the number of packets that have arrived since

last reset Reset happens when either a packet is dropped or

AvgLen is above MaxThreshold

TempP = (MaxP) * (AvgLen – MinThreshold)

MaxThreshold - MinThreshold

P = TempP

(1 – count * TempP)AvgLen

P(drop)1.0

MaxP

MinThresh MaxThresh

Page 34: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

RED Parameters

MaxP is typically set to 0.02 When the average queue size is halfway

between the two thresholds, the gateway drops roughly one out of 50 packets.

MinThreshold is typically max/2 Choosing parameters

Carefully tuned to maximize power function Confirmed through simulation But answer depends on accuracy of traffic model

Page 35: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Tuning RED

Probability of dropping a particular flow’s packet(s) Roughly proportional to the that flow’s current share of the

bandwidth If traffic is bursty

MinThreshold should be sufficiently large to allow link utilization to be maintained at an acceptably high level

If no buffer space is available, RED uses Tail Drop Difference between two thresholds

Should be larger than the typical increase in the calculated average queue length in one RTT

Setting MaxThreshold to twice MinThreshold is reasonable for traffic on today’s Internet

Page 36: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Source-Based Congestion Avoidance

Idea Source watches for some sign that some

router’s queue is building up and congestion will happen soon

Examples RTT is growing Sending rate flattens

Page 37: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

Source-Based Congestion Avoidance

Observe RTT If current RTT is greater than average of minRTT and maxRTT,

decrease congestion window by one-eigth Observe RTT and Window Size

Adjust window once every two RTT If (CurrWindow – OldWindow) * (CurrRTT – OldRTT) > 0, decrease

window by one-eigth, otherwise increase window my one MSS Observe sending rate

Increase window and compare throughput to previous value Observe throughput

Compare measured throughput with observed throughput TCP Vegas

Page 38: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

TCP Vegas

60

20

0.5 1.0 1.5 4.0 4.5 6.5 8.0

KB

Time (seconds)

70

304050

10

2.0 2.5 3.0 3.5 5.0 5.5 6.0 7.0 7.5 8.5

Time (seconds)

900

300100

0.5 1.0 1.5 4.0 4.5 6.5 8.0

Se

nd

ing

KB

ps

1100

500700

2.0 2.5 3.0 3.5 5.0 5.5 6.0 7.0 7.5 8.5

Time (seconds)0.5 1.0 1.5 4.0 4.5 6.5 8.0Q

ue

ue

siz

e in

ro

ute

r

5

10

2.0 2.5 3.0 3.5 5.0 5.5 6.0 7.0 7.5 8.5

Page 39: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

TCP Vegas

Basic idea Watch for signs of queue growth In particular, difference between

increasing congestion window stable throughput (presumably at capacity)

Keep just enough “extra data” in the network Time to react if bandwidth decreases Data available if bandwidth increases

Page 40: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

TCP Vegas

Implementation Estimate uncongested RTT

baseRTT = minimum measured RTT Expected throughput = congestion window /

baseRTT Measure throughput each RTT

Mark time of sending distinguished packet Calculate data sent between send time and

receipt of ACK

Page 41: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

TCP Vegas

Act to keep the difference between estimated and actual throughput in a specified range Below minimum threshold

Increase congestion window Above maximum threshold

Decrease congestion window

Additive decrease used only to avoid congestion Want between 1 and 3 packets of extra data (used to pick

min/max thresholds)

Page 42: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

TCP Vegas Algorithm

Let BaseRTT be minimum of all measured RTTs Commonly the RTT of the first packet

If not overflowing the connection, then ExpectRate = CongestionWindow/BaseRTT

Source calculates sending rate (ActualRate) once per RTT Source compares ActualRate with ExpectRate

Diff = ExpectedRate – ActualRate if Diff < a

Increase CongestionWindow linearly else if Diff > b

Decrease CongestionWindow linearly else

Leave CongestionWindow unchanged

Page 43: Congestion Control (cont’d). TCP Congestion Control Review Congestion control consists of 3 tasks  Detect congestion  Adjust sending rate  Determine

TCP Vegas Algorithm

Parameters = 1 packet = 3 packets

Even faster retransmit Keep fine-

grained timestamps for each packet

Check for timeout on first duplicate ACK

70605040302010

KB

Time (seconds)

0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0

0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0

CA

M K

Bp

s

2402001601208040

Time (seconds)