6
2/26/20 1 COMP 3825 Networking and Information Assurance TCP: Congestion Control COMP 3825 - Kan Yang 1 1 Learning Objectives 1. principles of congestion control 2. TCP congestion control COMP 3825 - Kan Yang 2 2 Principles of congestion control congestion: informally: too many sources sending too much data too fast for network to handledifferent from flow control! manifestations: lost packets (buffer overflow at routers) long delays (queueing in router buffers) a top-10 problem! COMP 3825 - Kan Yang 3 3 Causes/costs of congestion: scenario 1 § two senders, two receivers § one router, infinite buffers § output link capacity: R § no retransmission § maximum per-connection throughput: R/2 unlimited shared output link buffers Host A original data: lin Host B throughput: lout R/2 R/2 l out lin R/2 delay lin v large delays as arrival rate, l in , approaches capacity COMP 3825 - Kan Yang 4 4

Learning Objectives COMP 3825 Networking and Information ...kanyang/COMP3825/Lecture 11 TCP...TCP: Congestion Control COMP 3825 -Kan Yang 1 1 Learning Objectives 1.principles of congestion

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Learning Objectives COMP 3825 Networking and Information ...kanyang/COMP3825/Lecture 11 TCP...TCP: Congestion Control COMP 3825 -Kan Yang 1 1 Learning Objectives 1.principles of congestion

22620

1

COMP 3825 Networking and Information Assurance

TCP Congestion Control

COMP 3825 - Kan Yang 1

1

Learning Objectives

1 principles of congestion control

2 TCP congestion control

COMP 3825 - Kan Yang 2

2

Principles of congestion control

congestionbull informally ldquotoo many sources sending too much data too fast for

network to handlerdquobull different from flow controlbull manifestations

ndash lost packets (buffer overflow at routers)ndash long delays (queueing in router buffers)

bull a top-10 problem

COMP 3825 - Kan Yang 3

3

Causescosts of congestion scenario 1sect two senders two receiverssect one router infinite buffers sect output link capacity Rsect no retransmission

sect maximum per-connection throughput R2

unlimited shared output link buffers

Host A

original data lin

Host B

throughput lout

R2

R2

l out

lin R2

dela

y

linv large delays as arrival rate lin

approaches capacityCOMP 3825 - Kan Yang 4

4

22620

2

Causescosts of congestion scenario 2

sect one router finite buffers sect sender retransmission of timed-out packet

bull application-layer input = application-layer output 120582 = 120582ampbull transport-layer input includes retransmissions 120582 ge 120582amp

finite shared output link buffers

Host A

lin original data

Host B

loutlin original data plusretransmitted data

COMP 3825 - Kan Yang 5

5

idealization perfect knowledgesect sender sends only when router

buffers available

finite shared output link buffers

lin original dataloutlin original data plus

retransmitted data

copy

free buffer space

R2

R2

l out

lin

Causescosts of congestion scenario 2

Host B

A

COMP 3825 - Kan Yang 6

6

Causescosts of congestion scenario 2

Idealization packets can be lost dropped at router due to full bufferssect sender only resends if packet known to be lost

lin original dataloutlin original data plus

retransmitted data

copy

no buffer spaceA

Host BCOMP 3825 - Kan Yang 7

7

Causescosts of congestion scenario 2

Idealization packets can be lost dropped at router due to full bufferssect sender only resends if packet known to be lost

lin original dataloutlin original data plus

retransmitted data

free buffer spaceA

Host BCOMP 3825 - Kan Yang 8

8

22620

3

Causescosts of congestion scenario 2

Realistic duplicatessect packets can be lost dropped at router

due to full bufferssect sender times out prematurely sending

two copies both of which are delivered

A

linloutlincopy

free buffer space

timeout

R2

R2lin

lout

when sending at R2 some packets are retransmissions including duplicated that are delivered

Host BCOMP 3825 - Kan Yang 9

9

Causescosts of congestion scenario 2Realistic duplicatessect packets can be lost dropped at router

due to full bufferssect sender times out prematurely sending

two copies both of which are delivered

R2

R2lin

lout

when sending at R2 some packets are retransmissions including duplicated that are delivered

ldquocostsrdquo of congestionsect more work (retrans) for given ldquogoodputrdquo (application-level throughput)sect unneeded retransmissions link carries multiple copies of pkt

bull decreasing goodput

COMP 3825 - Kan Yang 10

10

Causescosts of congestion scenario 3

sect four senderssect multihop pathssect timeoutretransmit

Q what happens as lin and linrsquo increase

finite shared output link buffers

Host A lout Host B

Host CHost D

lin original datalin original data plus

retransmitted data

A as red linrsquo increases all arriving blue pktsat upper queue are dropped blue throughput g 0

COMP 3825 - Kan Yang 11

11

another ldquocostrdquo of congestionsect when packet dropped any ldquoupstream transmission

capacityrdquo used for that packet was wasted

Causescosts of congestion scenario 3

C2

C2

l out

linrsquo

COMP 3825 - Kan Yang 12

12

22620

4

Learning Objectives

1 principles of congestion control

2 TCP congestion control

COMP 3825 - Kan Yang 13

13

TCP congestion control additive increase multiplicative decrease

sect approach sender increases transmission rate (window size) probing for usable bandwidth until loss occursbull additive increase increase cwnd (congestion window) by 1

MSS (maximum segment size) every RTT until loss detectedbull multiplicative decrease cut cwnd in half after loss

cwnd

TCP

send

er

cong

estio

n wi

ndow

size

AIMD saw toothbehavior probing

for bandwidth

additively increase window size helliphellip until loss occurs (then cut window in half)

timeCOMP 3825 - Kan Yang 14

14

TCP Congestion Control details

sect sender limits transmission

sect cwnd is dynamic function of perceived network congestion

TCP sending ratesect roughly send cwnd bytes wait

RTT for ACKS then send more bytes

last byteACKed sent not-

yet ACKed(ldquoin-flightrdquo)

last byte sent

cwnd

LastByteSent - LastByteAcked lt cwnd

sender sequence number space

rate ~~cwndRTT

bytessec

COMP 3825 - Kan Yang 15

15

TCP Slow Start sect when connection begins increase

rate exponentially until first loss eventbull initially cwnd = 1 MSSbull double cwnd every RTTbull done by incrementing cwnd for

every ACK received

sect summary initial rate is slow but ramps up exponentially fast

Host A

one segment

RTT

Host B

time

two segments

four segments

COMP 3825 - Kan Yang 16

16

22620

5

TCP detecting reacting to losssect loss indicated by timeout

bull cwnd set to 1 MSS bull window then grows exponentially (as in slow start) to threshold

then grows linearly

sect loss indicated by 3 duplicate ACKs TCP RENObull dup ACKs indicate network capable of delivering some segments bull cwnd is cut in half window then grows linearly

sect TCP Tahoe always sets cwnd to 1 (timeout or 3 duplicate acks)

COMP 3825 - Kan Yang 17

17

Fast RecoveryQ when should the exponential increase switch to linear A when cwnd gets to 12 of its value before timeout

Implementationsect variable ssthresh

(slow start threshold)sect on loss event ssthresh

is set to 12 of cwnd just before loss event

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

COMP 3825 - Kan Yang 18

18

TCP throughputbull avg TCP thruput as function of window size RTT

ndash ignore slow start assume always data to send

bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg thruput is 34W per RTT

W

W2

avg TCP thruput = 34

WRTT bytessec

COMP 3825 - Kan Yang 20

20

TCP Futures TCP over ldquolong fat pipesrdquo

bull example 1500 byte segments 100ms RTT want 10 Gbps throughputbull requires W = 83333 in-flight segmentsbull throughput in terms of segment loss probability L [Mathis 1997]

to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate

bull new versions of TCP for high-speed

TCP throughput = 122 MSSRTT L

COMP 3825 - Kan Yang 21

21

22620

6

TCP Fairnessfairness goal if K TCP sessions share same bottleneck link of bandwidth R

each should have average rate of RK

TCP connection 1

bottleneckrouter

capacity RTCP connection 2

COMP 3825 - Kan Yang 22

22

Why is TCP fairtwo competing sessionssect additive increase gives slope of 1 as throughout increasessect multiplicative decrease decreases throughput proportionally

R

R

equal bandwidth share

Connection 1 throughput

Con

nect

ion

2 th

roug

hput

congestion avoidance additive increaseloss decrease window by factor of 2

congestion avoidance additive increaseloss decrease window by factor of 2

COMP 3825 - Kan Yang 23

23

Fairness (more)Fairness and UDPsect multimedia apps often do not use TCP

bull do not want rate throttled by congestion controlsect instead use UDP

bull send audiovideo at constant rate tolerate packet loss

Fairness parallel TCP connectionssect application can open multiple parallel connections between two hostssect web browsers do this sect eg link of rate R with 9 existing connections

bull new app asks for 1 TCP gets rate R10bull new app asks for 11 TCPs gets R2

COMP 3825 - Kan Yang 24

24

Explicit Congestion Notification (ECN)

network-assisted congestion controlsect two bits in IP header (ToS field) marked by network router to indicate congestionsect congestion indication carried to receiving hostsect receiver (seeing congestion indication in IP datagram) ) sets ECE (ECN-Echo) bit on

receiver-to-sender ACK segment to notify sender of congestion

source

applicationtransportnetwork

linkphysical

destination

applicationtransportnetwork

linkphysical

ECN=00 ECN=11

ECE=1

IP datagram

TCP ACK segment

COMP 3825 - Kan Yang 25

25

Page 2: Learning Objectives COMP 3825 Networking and Information ...kanyang/COMP3825/Lecture 11 TCP...TCP: Congestion Control COMP 3825 -Kan Yang 1 1 Learning Objectives 1.principles of congestion

22620

2

Causescosts of congestion scenario 2

sect one router finite buffers sect sender retransmission of timed-out packet

bull application-layer input = application-layer output 120582 = 120582ampbull transport-layer input includes retransmissions 120582 ge 120582amp

finite shared output link buffers

Host A

lin original data

Host B

loutlin original data plusretransmitted data

COMP 3825 - Kan Yang 5

5

idealization perfect knowledgesect sender sends only when router

buffers available

finite shared output link buffers

lin original dataloutlin original data plus

retransmitted data

copy

free buffer space

R2

R2

l out

lin

Causescosts of congestion scenario 2

Host B

A

COMP 3825 - Kan Yang 6

6

Causescosts of congestion scenario 2

Idealization packets can be lost dropped at router due to full bufferssect sender only resends if packet known to be lost

lin original dataloutlin original data plus

retransmitted data

copy

no buffer spaceA

Host BCOMP 3825 - Kan Yang 7

7

Causescosts of congestion scenario 2

Idealization packets can be lost dropped at router due to full bufferssect sender only resends if packet known to be lost

lin original dataloutlin original data plus

retransmitted data

free buffer spaceA

Host BCOMP 3825 - Kan Yang 8

8

22620

3

Causescosts of congestion scenario 2

Realistic duplicatessect packets can be lost dropped at router

due to full bufferssect sender times out prematurely sending

two copies both of which are delivered

A

linloutlincopy

free buffer space

timeout

R2

R2lin

lout

when sending at R2 some packets are retransmissions including duplicated that are delivered

Host BCOMP 3825 - Kan Yang 9

9

Causescosts of congestion scenario 2Realistic duplicatessect packets can be lost dropped at router

due to full bufferssect sender times out prematurely sending

two copies both of which are delivered

R2

R2lin

lout

when sending at R2 some packets are retransmissions including duplicated that are delivered

ldquocostsrdquo of congestionsect more work (retrans) for given ldquogoodputrdquo (application-level throughput)sect unneeded retransmissions link carries multiple copies of pkt

bull decreasing goodput

COMP 3825 - Kan Yang 10

10

Causescosts of congestion scenario 3

sect four senderssect multihop pathssect timeoutretransmit

Q what happens as lin and linrsquo increase

finite shared output link buffers

Host A lout Host B

Host CHost D

lin original datalin original data plus

retransmitted data

A as red linrsquo increases all arriving blue pktsat upper queue are dropped blue throughput g 0

COMP 3825 - Kan Yang 11

11

another ldquocostrdquo of congestionsect when packet dropped any ldquoupstream transmission

capacityrdquo used for that packet was wasted

Causescosts of congestion scenario 3

C2

C2

l out

linrsquo

COMP 3825 - Kan Yang 12

12

22620

4

Learning Objectives

1 principles of congestion control

2 TCP congestion control

COMP 3825 - Kan Yang 13

13

TCP congestion control additive increase multiplicative decrease

sect approach sender increases transmission rate (window size) probing for usable bandwidth until loss occursbull additive increase increase cwnd (congestion window) by 1

MSS (maximum segment size) every RTT until loss detectedbull multiplicative decrease cut cwnd in half after loss

cwnd

TCP

send

er

cong

estio

n wi

ndow

size

AIMD saw toothbehavior probing

for bandwidth

additively increase window size helliphellip until loss occurs (then cut window in half)

timeCOMP 3825 - Kan Yang 14

14

TCP Congestion Control details

sect sender limits transmission

sect cwnd is dynamic function of perceived network congestion

TCP sending ratesect roughly send cwnd bytes wait

RTT for ACKS then send more bytes

last byteACKed sent not-

yet ACKed(ldquoin-flightrdquo)

last byte sent

cwnd

LastByteSent - LastByteAcked lt cwnd

sender sequence number space

rate ~~cwndRTT

bytessec

COMP 3825 - Kan Yang 15

15

TCP Slow Start sect when connection begins increase

rate exponentially until first loss eventbull initially cwnd = 1 MSSbull double cwnd every RTTbull done by incrementing cwnd for

every ACK received

sect summary initial rate is slow but ramps up exponentially fast

Host A

one segment

RTT

Host B

time

two segments

four segments

COMP 3825 - Kan Yang 16

16

22620

5

TCP detecting reacting to losssect loss indicated by timeout

bull cwnd set to 1 MSS bull window then grows exponentially (as in slow start) to threshold

then grows linearly

sect loss indicated by 3 duplicate ACKs TCP RENObull dup ACKs indicate network capable of delivering some segments bull cwnd is cut in half window then grows linearly

sect TCP Tahoe always sets cwnd to 1 (timeout or 3 duplicate acks)

COMP 3825 - Kan Yang 17

17

Fast RecoveryQ when should the exponential increase switch to linear A when cwnd gets to 12 of its value before timeout

Implementationsect variable ssthresh

(slow start threshold)sect on loss event ssthresh

is set to 12 of cwnd just before loss event

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

COMP 3825 - Kan Yang 18

18

TCP throughputbull avg TCP thruput as function of window size RTT

ndash ignore slow start assume always data to send

bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg thruput is 34W per RTT

W

W2

avg TCP thruput = 34

WRTT bytessec

COMP 3825 - Kan Yang 20

20

TCP Futures TCP over ldquolong fat pipesrdquo

bull example 1500 byte segments 100ms RTT want 10 Gbps throughputbull requires W = 83333 in-flight segmentsbull throughput in terms of segment loss probability L [Mathis 1997]

to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate

bull new versions of TCP for high-speed

TCP throughput = 122 MSSRTT L

COMP 3825 - Kan Yang 21

21

22620

6

TCP Fairnessfairness goal if K TCP sessions share same bottleneck link of bandwidth R

each should have average rate of RK

TCP connection 1

bottleneckrouter

capacity RTCP connection 2

COMP 3825 - Kan Yang 22

22

Why is TCP fairtwo competing sessionssect additive increase gives slope of 1 as throughout increasessect multiplicative decrease decreases throughput proportionally

R

R

equal bandwidth share

Connection 1 throughput

Con

nect

ion

2 th

roug

hput

congestion avoidance additive increaseloss decrease window by factor of 2

congestion avoidance additive increaseloss decrease window by factor of 2

COMP 3825 - Kan Yang 23

23

Fairness (more)Fairness and UDPsect multimedia apps often do not use TCP

bull do not want rate throttled by congestion controlsect instead use UDP

bull send audiovideo at constant rate tolerate packet loss

Fairness parallel TCP connectionssect application can open multiple parallel connections between two hostssect web browsers do this sect eg link of rate R with 9 existing connections

bull new app asks for 1 TCP gets rate R10bull new app asks for 11 TCPs gets R2

COMP 3825 - Kan Yang 24

24

Explicit Congestion Notification (ECN)

network-assisted congestion controlsect two bits in IP header (ToS field) marked by network router to indicate congestionsect congestion indication carried to receiving hostsect receiver (seeing congestion indication in IP datagram) ) sets ECE (ECN-Echo) bit on

receiver-to-sender ACK segment to notify sender of congestion

source

applicationtransportnetwork

linkphysical

destination

applicationtransportnetwork

linkphysical

ECN=00 ECN=11

ECE=1

IP datagram

TCP ACK segment

COMP 3825 - Kan Yang 25

25

Page 3: Learning Objectives COMP 3825 Networking and Information ...kanyang/COMP3825/Lecture 11 TCP...TCP: Congestion Control COMP 3825 -Kan Yang 1 1 Learning Objectives 1.principles of congestion

22620

3

Causescosts of congestion scenario 2

Realistic duplicatessect packets can be lost dropped at router

due to full bufferssect sender times out prematurely sending

two copies both of which are delivered

A

linloutlincopy

free buffer space

timeout

R2

R2lin

lout

when sending at R2 some packets are retransmissions including duplicated that are delivered

Host BCOMP 3825 - Kan Yang 9

9

Causescosts of congestion scenario 2Realistic duplicatessect packets can be lost dropped at router

due to full bufferssect sender times out prematurely sending

two copies both of which are delivered

R2

R2lin

lout

when sending at R2 some packets are retransmissions including duplicated that are delivered

ldquocostsrdquo of congestionsect more work (retrans) for given ldquogoodputrdquo (application-level throughput)sect unneeded retransmissions link carries multiple copies of pkt

bull decreasing goodput

COMP 3825 - Kan Yang 10

10

Causescosts of congestion scenario 3

sect four senderssect multihop pathssect timeoutretransmit

Q what happens as lin and linrsquo increase

finite shared output link buffers

Host A lout Host B

Host CHost D

lin original datalin original data plus

retransmitted data

A as red linrsquo increases all arriving blue pktsat upper queue are dropped blue throughput g 0

COMP 3825 - Kan Yang 11

11

another ldquocostrdquo of congestionsect when packet dropped any ldquoupstream transmission

capacityrdquo used for that packet was wasted

Causescosts of congestion scenario 3

C2

C2

l out

linrsquo

COMP 3825 - Kan Yang 12

12

22620

4

Learning Objectives

1 principles of congestion control

2 TCP congestion control

COMP 3825 - Kan Yang 13

13

TCP congestion control additive increase multiplicative decrease

sect approach sender increases transmission rate (window size) probing for usable bandwidth until loss occursbull additive increase increase cwnd (congestion window) by 1

MSS (maximum segment size) every RTT until loss detectedbull multiplicative decrease cut cwnd in half after loss

cwnd

TCP

send

er

cong

estio

n wi

ndow

size

AIMD saw toothbehavior probing

for bandwidth

additively increase window size helliphellip until loss occurs (then cut window in half)

timeCOMP 3825 - Kan Yang 14

14

TCP Congestion Control details

sect sender limits transmission

sect cwnd is dynamic function of perceived network congestion

TCP sending ratesect roughly send cwnd bytes wait

RTT for ACKS then send more bytes

last byteACKed sent not-

yet ACKed(ldquoin-flightrdquo)

last byte sent

cwnd

LastByteSent - LastByteAcked lt cwnd

sender sequence number space

rate ~~cwndRTT

bytessec

COMP 3825 - Kan Yang 15

15

TCP Slow Start sect when connection begins increase

rate exponentially until first loss eventbull initially cwnd = 1 MSSbull double cwnd every RTTbull done by incrementing cwnd for

every ACK received

sect summary initial rate is slow but ramps up exponentially fast

Host A

one segment

RTT

Host B

time

two segments

four segments

COMP 3825 - Kan Yang 16

16

22620

5

TCP detecting reacting to losssect loss indicated by timeout

bull cwnd set to 1 MSS bull window then grows exponentially (as in slow start) to threshold

then grows linearly

sect loss indicated by 3 duplicate ACKs TCP RENObull dup ACKs indicate network capable of delivering some segments bull cwnd is cut in half window then grows linearly

sect TCP Tahoe always sets cwnd to 1 (timeout or 3 duplicate acks)

COMP 3825 - Kan Yang 17

17

Fast RecoveryQ when should the exponential increase switch to linear A when cwnd gets to 12 of its value before timeout

Implementationsect variable ssthresh

(slow start threshold)sect on loss event ssthresh

is set to 12 of cwnd just before loss event

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

COMP 3825 - Kan Yang 18

18

TCP throughputbull avg TCP thruput as function of window size RTT

ndash ignore slow start assume always data to send

bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg thruput is 34W per RTT

W

W2

avg TCP thruput = 34

WRTT bytessec

COMP 3825 - Kan Yang 20

20

TCP Futures TCP over ldquolong fat pipesrdquo

bull example 1500 byte segments 100ms RTT want 10 Gbps throughputbull requires W = 83333 in-flight segmentsbull throughput in terms of segment loss probability L [Mathis 1997]

to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate

bull new versions of TCP for high-speed

TCP throughput = 122 MSSRTT L

COMP 3825 - Kan Yang 21

21

22620

6

TCP Fairnessfairness goal if K TCP sessions share same bottleneck link of bandwidth R

each should have average rate of RK

TCP connection 1

bottleneckrouter

capacity RTCP connection 2

COMP 3825 - Kan Yang 22

22

Why is TCP fairtwo competing sessionssect additive increase gives slope of 1 as throughout increasessect multiplicative decrease decreases throughput proportionally

R

R

equal bandwidth share

Connection 1 throughput

Con

nect

ion

2 th

roug

hput

congestion avoidance additive increaseloss decrease window by factor of 2

congestion avoidance additive increaseloss decrease window by factor of 2

COMP 3825 - Kan Yang 23

23

Fairness (more)Fairness and UDPsect multimedia apps often do not use TCP

bull do not want rate throttled by congestion controlsect instead use UDP

bull send audiovideo at constant rate tolerate packet loss

Fairness parallel TCP connectionssect application can open multiple parallel connections between two hostssect web browsers do this sect eg link of rate R with 9 existing connections

bull new app asks for 1 TCP gets rate R10bull new app asks for 11 TCPs gets R2

COMP 3825 - Kan Yang 24

24

Explicit Congestion Notification (ECN)

network-assisted congestion controlsect two bits in IP header (ToS field) marked by network router to indicate congestionsect congestion indication carried to receiving hostsect receiver (seeing congestion indication in IP datagram) ) sets ECE (ECN-Echo) bit on

receiver-to-sender ACK segment to notify sender of congestion

source

applicationtransportnetwork

linkphysical

destination

applicationtransportnetwork

linkphysical

ECN=00 ECN=11

ECE=1

IP datagram

TCP ACK segment

COMP 3825 - Kan Yang 25

25

Page 4: Learning Objectives COMP 3825 Networking and Information ...kanyang/COMP3825/Lecture 11 TCP...TCP: Congestion Control COMP 3825 -Kan Yang 1 1 Learning Objectives 1.principles of congestion

22620

4

Learning Objectives

1 principles of congestion control

2 TCP congestion control

COMP 3825 - Kan Yang 13

13

TCP congestion control additive increase multiplicative decrease

sect approach sender increases transmission rate (window size) probing for usable bandwidth until loss occursbull additive increase increase cwnd (congestion window) by 1

MSS (maximum segment size) every RTT until loss detectedbull multiplicative decrease cut cwnd in half after loss

cwnd

TCP

send

er

cong

estio

n wi

ndow

size

AIMD saw toothbehavior probing

for bandwidth

additively increase window size helliphellip until loss occurs (then cut window in half)

timeCOMP 3825 - Kan Yang 14

14

TCP Congestion Control details

sect sender limits transmission

sect cwnd is dynamic function of perceived network congestion

TCP sending ratesect roughly send cwnd bytes wait

RTT for ACKS then send more bytes

last byteACKed sent not-

yet ACKed(ldquoin-flightrdquo)

last byte sent

cwnd

LastByteSent - LastByteAcked lt cwnd

sender sequence number space

rate ~~cwndRTT

bytessec

COMP 3825 - Kan Yang 15

15

TCP Slow Start sect when connection begins increase

rate exponentially until first loss eventbull initially cwnd = 1 MSSbull double cwnd every RTTbull done by incrementing cwnd for

every ACK received

sect summary initial rate is slow but ramps up exponentially fast

Host A

one segment

RTT

Host B

time

two segments

four segments

COMP 3825 - Kan Yang 16

16

22620

5

TCP detecting reacting to losssect loss indicated by timeout

bull cwnd set to 1 MSS bull window then grows exponentially (as in slow start) to threshold

then grows linearly

sect loss indicated by 3 duplicate ACKs TCP RENObull dup ACKs indicate network capable of delivering some segments bull cwnd is cut in half window then grows linearly

sect TCP Tahoe always sets cwnd to 1 (timeout or 3 duplicate acks)

COMP 3825 - Kan Yang 17

17

Fast RecoveryQ when should the exponential increase switch to linear A when cwnd gets to 12 of its value before timeout

Implementationsect variable ssthresh

(slow start threshold)sect on loss event ssthresh

is set to 12 of cwnd just before loss event

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

COMP 3825 - Kan Yang 18

18

TCP throughputbull avg TCP thruput as function of window size RTT

ndash ignore slow start assume always data to send

bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg thruput is 34W per RTT

W

W2

avg TCP thruput = 34

WRTT bytessec

COMP 3825 - Kan Yang 20

20

TCP Futures TCP over ldquolong fat pipesrdquo

bull example 1500 byte segments 100ms RTT want 10 Gbps throughputbull requires W = 83333 in-flight segmentsbull throughput in terms of segment loss probability L [Mathis 1997]

to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate

bull new versions of TCP for high-speed

TCP throughput = 122 MSSRTT L

COMP 3825 - Kan Yang 21

21

22620

6

TCP Fairnessfairness goal if K TCP sessions share same bottleneck link of bandwidth R

each should have average rate of RK

TCP connection 1

bottleneckrouter

capacity RTCP connection 2

COMP 3825 - Kan Yang 22

22

Why is TCP fairtwo competing sessionssect additive increase gives slope of 1 as throughout increasessect multiplicative decrease decreases throughput proportionally

R

R

equal bandwidth share

Connection 1 throughput

Con

nect

ion

2 th

roug

hput

congestion avoidance additive increaseloss decrease window by factor of 2

congestion avoidance additive increaseloss decrease window by factor of 2

COMP 3825 - Kan Yang 23

23

Fairness (more)Fairness and UDPsect multimedia apps often do not use TCP

bull do not want rate throttled by congestion controlsect instead use UDP

bull send audiovideo at constant rate tolerate packet loss

Fairness parallel TCP connectionssect application can open multiple parallel connections between two hostssect web browsers do this sect eg link of rate R with 9 existing connections

bull new app asks for 1 TCP gets rate R10bull new app asks for 11 TCPs gets R2

COMP 3825 - Kan Yang 24

24

Explicit Congestion Notification (ECN)

network-assisted congestion controlsect two bits in IP header (ToS field) marked by network router to indicate congestionsect congestion indication carried to receiving hostsect receiver (seeing congestion indication in IP datagram) ) sets ECE (ECN-Echo) bit on

receiver-to-sender ACK segment to notify sender of congestion

source

applicationtransportnetwork

linkphysical

destination

applicationtransportnetwork

linkphysical

ECN=00 ECN=11

ECE=1

IP datagram

TCP ACK segment

COMP 3825 - Kan Yang 25

25

Page 5: Learning Objectives COMP 3825 Networking and Information ...kanyang/COMP3825/Lecture 11 TCP...TCP: Congestion Control COMP 3825 -Kan Yang 1 1 Learning Objectives 1.principles of congestion

22620

5

TCP detecting reacting to losssect loss indicated by timeout

bull cwnd set to 1 MSS bull window then grows exponentially (as in slow start) to threshold

then grows linearly

sect loss indicated by 3 duplicate ACKs TCP RENObull dup ACKs indicate network capable of delivering some segments bull cwnd is cut in half window then grows linearly

sect TCP Tahoe always sets cwnd to 1 (timeout or 3 duplicate acks)

COMP 3825 - Kan Yang 17

17

Fast RecoveryQ when should the exponential increase switch to linear A when cwnd gets to 12 of its value before timeout

Implementationsect variable ssthresh

(slow start threshold)sect on loss event ssthresh

is set to 12 of cwnd just before loss event

Check out the online interactive exercises for more examples httpgaiacsumassedukurose_rossinteractive

COMP 3825 - Kan Yang 18

18

TCP throughputbull avg TCP thruput as function of window size RTT

ndash ignore slow start assume always data to send

bull W window size (measured in bytes) where loss occursndash avg window size ( in-flight bytes) is frac34 Wndash avg thruput is 34W per RTT

W

W2

avg TCP thruput = 34

WRTT bytessec

COMP 3825 - Kan Yang 20

20

TCP Futures TCP over ldquolong fat pipesrdquo

bull example 1500 byte segments 100ms RTT want 10 Gbps throughputbull requires W = 83333 in-flight segmentsbull throughput in terms of segment loss probability L [Mathis 1997]

to achieve 10 Gbps throughput need a loss rate of L = 210-10 ndash a very small loss rate

bull new versions of TCP for high-speed

TCP throughput = 122 MSSRTT L

COMP 3825 - Kan Yang 21

21

22620

6

TCP Fairnessfairness goal if K TCP sessions share same bottleneck link of bandwidth R

each should have average rate of RK

TCP connection 1

bottleneckrouter

capacity RTCP connection 2

COMP 3825 - Kan Yang 22

22

Why is TCP fairtwo competing sessionssect additive increase gives slope of 1 as throughout increasessect multiplicative decrease decreases throughput proportionally

R

R

equal bandwidth share

Connection 1 throughput

Con

nect

ion

2 th

roug

hput

congestion avoidance additive increaseloss decrease window by factor of 2

congestion avoidance additive increaseloss decrease window by factor of 2

COMP 3825 - Kan Yang 23

23

Fairness (more)Fairness and UDPsect multimedia apps often do not use TCP

bull do not want rate throttled by congestion controlsect instead use UDP

bull send audiovideo at constant rate tolerate packet loss

Fairness parallel TCP connectionssect application can open multiple parallel connections between two hostssect web browsers do this sect eg link of rate R with 9 existing connections

bull new app asks for 1 TCP gets rate R10bull new app asks for 11 TCPs gets R2

COMP 3825 - Kan Yang 24

24

Explicit Congestion Notification (ECN)

network-assisted congestion controlsect two bits in IP header (ToS field) marked by network router to indicate congestionsect congestion indication carried to receiving hostsect receiver (seeing congestion indication in IP datagram) ) sets ECE (ECN-Echo) bit on

receiver-to-sender ACK segment to notify sender of congestion

source

applicationtransportnetwork

linkphysical

destination

applicationtransportnetwork

linkphysical

ECN=00 ECN=11

ECE=1

IP datagram

TCP ACK segment

COMP 3825 - Kan Yang 25

25

Page 6: Learning Objectives COMP 3825 Networking and Information ...kanyang/COMP3825/Lecture 11 TCP...TCP: Congestion Control COMP 3825 -Kan Yang 1 1 Learning Objectives 1.principles of congestion

22620

6

TCP Fairnessfairness goal if K TCP sessions share same bottleneck link of bandwidth R

each should have average rate of RK

TCP connection 1

bottleneckrouter

capacity RTCP connection 2

COMP 3825 - Kan Yang 22

22

Why is TCP fairtwo competing sessionssect additive increase gives slope of 1 as throughout increasessect multiplicative decrease decreases throughput proportionally

R

R

equal bandwidth share

Connection 1 throughput

Con

nect

ion

2 th

roug

hput

congestion avoidance additive increaseloss decrease window by factor of 2

congestion avoidance additive increaseloss decrease window by factor of 2

COMP 3825 - Kan Yang 23

23

Fairness (more)Fairness and UDPsect multimedia apps often do not use TCP

bull do not want rate throttled by congestion controlsect instead use UDP

bull send audiovideo at constant rate tolerate packet loss

Fairness parallel TCP connectionssect application can open multiple parallel connections between two hostssect web browsers do this sect eg link of rate R with 9 existing connections

bull new app asks for 1 TCP gets rate R10bull new app asks for 11 TCPs gets R2

COMP 3825 - Kan Yang 24

24

Explicit Congestion Notification (ECN)

network-assisted congestion controlsect two bits in IP header (ToS field) marked by network router to indicate congestionsect congestion indication carried to receiving hostsect receiver (seeing congestion indication in IP datagram) ) sets ECE (ECN-Echo) bit on

receiver-to-sender ACK segment to notify sender of congestion

source

applicationtransportnetwork

linkphysical

destination

applicationtransportnetwork

linkphysical

ECN=00 ECN=11

ECE=1

IP datagram

TCP ACK segment

COMP 3825 - Kan Yang 25

25