tcp congestion control dina katabi & sam madden nms.csail.mit.edu/~dina 6.033, spring 2014

22
TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

Upload: darlene-gibson

Post on 16-Dec-2015

225 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

TCP Congestion Control

Dina Katabi & Sam Madden

nms.csail.mit.edu/~dina

6.033, Spring 2014

Page 2: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

Sharing the Internet

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

Difficult because of:

Size Billions of users, links, routers

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

Page 3: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

CongestionS1

S2

R1 D

10Mb/s

2Mb/s

100Mb/s

S1

S2

Sources compete for link bandwidth, and buffer space

Why a problem? Sources are unaware of current state of resource Sources 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

the above topology (congestion collapse)

Page 4: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

Objectives of Congestion Control Efficiency & Fairness

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 5: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

Fairness

Max-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/s3=

Demands

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

Max-min Fair Rates

Page 6: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

TCP

Page 7: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

TCP TCP provides reliability & congestion control

Reliable transmission ensures the receiver’s application receives the correct and complete data sent by the sender’s application TCP recovers from lost packets, eliminates

duplicates and ensures in-order packet delivery to the application

Reliability was discussed in 6.02

Congestion control Sender reacts to congestion and discovers its fair

and efficient send rate

Page 8: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

TCP Cong. Cont.

Basic Idea: Send a few packets. If a packet is dropped

decrease rate. If no drops, increase rate How does TCP detect drops?

Packets have sequence numbers Receiver acks the next expected sequence number (i.e., if

received 1, it acks 2 saying it is expecting 2 to arrive next. Note that TCP implementations ack bytes but for simplicity we talk about acking packets.)

Page 9: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

TCP controls throughput via the congestion window

Congestion window is the number of outstanding packets, i.e., number of packets sender can send without waiting for an ack

TCP is window-based: sources change their sending rate by modifying the window size: “cwnd” Avg. Throughput = (Avg. cwnd) /(Avg. RTT)

Why not changing rate directly?

Window protocols are easy to implement (no need for accurate timers, i.e., works for slow machines an sensors)

Page 10: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

How much should TCP Increase/decrease?

Probe for the correct sending window

Additive Increase / Multiplicative Decrease (AIMD) Every RTT:

No loss: cwnd = cwnd + 1

A loss: cwnd = cwnd /2

Page 11: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

Additive Increase

D A

Src

Dest

cwnd = 1

cwnd += 1cwnd = 2

D D A A

cwnd = 3

D D A AD A

cwnd = 4

Actually,

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

Page 12: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

AIMD Leads to Efficiency and Fairness

User 1: x1

Use

r 2

: x

2

fairnessline

Efficiency line(x1+x2 = BW)

(x1,x2)

(bx1,bx2)

(bx1+a,bx2+a)

Page 13: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

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 14: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

“Slow Start”

D A D D A A D D

A A

D

A

Src

Dest

D

A

1 2 4 8

A A A A

Cold start a connection at startup or after a timeout

At the beginning of a connection, increase exponentially

On ack arrival: cwnd += 1

Page 15: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

Adding Slow Start

Time

Exponential Increase

Loss+Timeout

Slow start stops at halve previous cwnd

CongestionWindow

AIMD

Page 16: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

Fast Retransmit Timeouts are too slow

When packet is dropped, receiver still acks the next in-order packet

Use 3 duplicate ACKs to indicate a drop Why 3? When this does not work?

Tweaking TCP

Fast Recovery If there are still ACKs coming in then no need for

slow-start Divide cwnd by 2 after fast retransmit Increment cwnd by 1/cwnd for each dupack

Page 17: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

Putting It Together

Time

CongestionWindow

Page 18: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

Putting It Together

Time

CongestionWindow

Slow Start

Page 19: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

Putting It Together

Time

CongestionWindow

3 dupacks (Fast Retransmit)

Page 20: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

Putting It Together

Time

CongestionWindow

Fast Recovery

Page 21: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

TCP Steady-State Throughput as Function of Loss Rate

W(t)

Wm

Wm/2

1 drop

time

RTT * Wm/2

pktWW mm

22

222

1

23

8

mWp 1 drop every so, drop rate is:

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

RTT

Wm4

3

From the two eq.

pRTT

2/3

Page 22: TCP Congestion Control Dina Katabi & Sam Madden nms.csail.mit.edu/~dina 6.033, Spring 2014

Reflections on TCP

The probing mechanism of TCP is based on causing congestion then detecting it

Assumes that all sources cooperate Assumes flows are long enough Too bursty Vulnerable to non-congestion related loss

(e.g. wireless errors) Unfair to long RTT flows