32
End-to-End Congestion Control TCP Dina Katabi nms.csail.mit.edu/~dina

End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Embed Size (px)

Citation preview

Page 1: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

End-to-End Congestion ControlTCP

Dina Katabinms.csail.mit.edu/~dina

Page 2: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Sharing the InternetHow do you manage the resources in a huge system like the Internet, where users with different interests share the same resources?

Difficult because of:

SizeBillions of users, links, routers

Heterogeneitybandwidth: 9.6Kb/s (then modem, now cellular), 10 Tb/s latency: 50us (LAN), 133ms (wired), 1s (satellite), 260s (Mars)

Page 3: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

CongestionS1

S2

R1 D

10Mb/s

2Mb/s

100Mb/sS1

S2

Sources compete for bandwidth, and buffer space

Why a problem?Sources are unaware of current state of resourceSources are unaware of each other

Manifestations:Lost packets (buffer overflow at routers)Long delays (queuing in router buffers)In many situations will result in < 2 Mb/s of throughput for theabove topology (congestion collapse)

Page 4: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Congestion CollapseIncrease in input traffic leads to decrease in useful work

Input traffic

Thro

ughp

ut cliffCongestion Collapse

knee

Latency

Many possible causesSpurious retransmissions of packets still in flightPacket consume resources and then they are dropped downstreamControl Traffic

Page 5: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

What can be done?Increase network resources

But demands will increase too!

Admission ControlUsed in telephone networksHard in the Internet because can’t model traffic well

Congestion control: ask the sources to slow downPlausible because Internet applications are elasticBut how?

How do the sources learn of congestion?What is the correct sending rate?What’s the role of the sender and what is the role of the router?

Page 6: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Objectives of Cong. Cont.Efficiency

Maximize link utilization Minimize queue size (i.e., delay)Minimize packet drops

Many solutions! (S1= 1 Mb/s, S2= 1 Mb/s) and (S1=1.5 Mb/s, S2=0.5 Mb/s) are both efficient.

Want Fairness

S1

S2

R1 D

10Mb/s

2Mb/s

100Mb/s

Page 7: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

FairnessMax-Min Fairness

At each bottleneck, user gets min(user’s demand, fair share)User’s rate is the minimum max-min fair rate along the path

S1

S2 R1 D9Mb/s

S2

ρ1= 1Mb/s ρ2= 7Mb/sρ3= ∞

Demands

μ1= 1Mb/s μ2= 4Mb/s μ3= 4Mb/s

Max-min Fair Rates

Other measures of fairnessWant controlled unfairness

Page 8: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Important Principles

Distributed

Stable & Robust

Keep routers simple

2 Approaches to Congestion ControlEnd-system congestion control

Router is dumbSender detects cong.Sender reactsE.g. TCP

Network-centric cong. cont.

Router help in detecting cong and deciding what to doE.g., XCP

Page 9: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

TCP

Page 10: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

TCPTCP provides reliability & congestion control

Reliable transmission ensures the receiver application receives the correct and complete data sent by the sender application

TCP recovers from errors and lost packets

Congestion control sender reacts to congestion and discovers the fair and efficient send rate

Page 11: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

TCP Provides Reliability

Packets have sequence numbers

Receiver acks the next sequence number it expects to receive

D1 A2

Src

Dest

D2 A3 D3 A4

Page 12: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

TCP Provides Reliability

Sender sends a window of packets (has a window of outstanding pkts at any time)

Packets have sequence numbers a loss creates a hole in the received seq. number

Receiver uses cumulative acks, i.e., it acks the next seq. number it expects to receive

If ack K then received all packet with sequence number i< k

Sender advances the window beyond packets that were acked

Sender times out

Sender retransmits dropped packets

Src

Dest

window = 5

Page 13: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Src

Dest

window = 1-5

1 2 3 4 5

p1

x

Page 14: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Src

Dest

window = 2-6

1 2 3 4 5

p1

a2

x

6

Page 15: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Src

Dest

window = 2-6

1 2 3 4 5

p1

a2

x

6

a2

p3

Page 16: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Src

Dest

window = 2-6

1 2 3 4 5

p1

a2

x

6

a2

p3

a2

p4

a2

p6

a2

p5

Timeout

2

a7

p2

Page 17: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Src

Dest

window = 7-11

1 2 3 5

p1

a2

4

x

6

a2

p3

a2

p4

a2

p6

a2

p5

Timeout

2

a7

p2

7 8 9 10 11

Timeout-based recovery is slow

New versions of TCPs use Fast Retransmit

Page 18: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

End-system Cong. Cont. TCP uses a host-based approach

Routers are DropTail and FIFOEnd-systems detect congestionEnd-systems react to congestion

Idea:Send a few packets. If a packet is dropped decrease rate. If no drops, increase rate

How does TCP detect drops?

Page 19: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

TCP controls throughput via the congestion window

Congestion window is the number of packets sender can send without an acknowledgement

TCP is window-based: sources change their sending rate by modifying the window size: “cwnd”

Throughput = cwnd /RTT

Why not changing rate directly?Window provides conservation of packets at equilibriumWindow protocols are easy to implementBut, they are BURSTY

Page 20: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

How much should TCP Increase/decrease?

Probe for the correct sending rate

Additive Increase / Multiplicative Decrease (AIMD)

Every RTT:No loss: cwnd = cwnd + 1A loss: cwnd = cwnd /2

Page 21: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Additive Increase

D A

Src

Dest

cwnd = 1cwnd += 1cwnd = 2

D D A A

cwnd = 3

D D A AD A

cwnd = 4

Actually,

On ack arrival: cwnd = cwnd + 1/cwndOn timeout: cwnd = cwnd /2

Page 22: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

AIMD Leads to Efficiency and Fairness

User 1: x1

Use

r 2:

x2

fairnessline

Efficiency line(x1+x2 = BW)

(x1,x2)

(bx1,bx2)

(bx1+a,bx2+a)

Page 23: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

TCP AIMD

Time

CongestionWindow

Grab back Bandwidth

Halve CongestionWindow (and Rate)

Timeout because of a packet loss

correct cwnd

Need the queue to absorb these saw-tooth oscillations

Page 24: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

“Slow Start”

D A D D A A D D

A A

D

A

Dest

Src

D

A

1 2 4 8

A A A A

Cold start a connection at startup or after a timeoutAt the beginning of a connection, increase exponentially

On ack arrival: cwnd += 1

Page 25: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Adding Slow Start

TimeSlow Start (Exponential Increase)

Loss+Timeout

Slow start stops at half the previous cwnd

CongestionWindow

AIMD

Page 26: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Fast RetransmitTimeouts are too slowWhen packet is dropped, receiver still acks the last in-order packetSender interprets 3 duplicate ACKs as a sign of drop

Why 3? When this is not useful?

Tweaking TCP

Fast RecoveryIf there are still ACKs coming in, then no to go back to cwnd=1 and do slow-startDivide cwnd by 2 after Fast RetransmitIncrement cwnd by 1/cwnd for each dupack (i.e., do AIMD)

Page 27: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Putting It Together

Time

CongestionWindow

Page 28: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Putting It Together

Time

CongestionWindow

Slow Start

Page 29: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Putting It Together

Time

CongestionWindow

3 dupacks (Fast Retransmit)

Page 30: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Putting It Together

Time

CongestionWindow

Fast Recovery

Page 31: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Steady-State Throughput as Function of Loss Rate

W(t)

Wm

Wm/2

1 drop

time

RTT * Wm/2

pktWW mm22

2221

⎟⎠⎞

⎜⎝⎛+⎟

⎠⎞

⎜⎝⎛× 23

8

mWp =1 drop every so, drop rate is:

Throughput λ is the packets sent divided by the time it took to send them

RTTWm

43

From the two eq.

pRTT2/3

≈λ

Page 32: End-to-End Congestion Control TCP - MITweb.mit.edu/6.263/www/TCP.pdf · TCP controls throughput via the congestion window Congestion window is the number of packets sender can send

Reflections on TCP

The probing mechanism of TCP is based on causing congestion then detecting itAssumes that all sources cooperateAssumes flows are long enoughToo burstyVulnerable to non-congestion related loss (e.g. wireless errors)Unfair to long RTT flows