Models of TCP · 2012-10-27 · Cumulative and Duplicate ACK Ack the lowest expected sequence...

Post on 14-Mar-2020

5 views 0 download

transcript

Models of TCP

Richard T. B. Ma

School of Computing

National University of Singapore

CS 5229: Advanced Compute Networks

TCP Congestion Window

Recall, for flow control, the Receiver keeps 𝑅𝑐𝑣𝑊𝑖𝑛𝑑𝑜𝑤 = 𝑅𝑐𝑣𝐵𝑢𝑓𝑓𝑒𝑟 – 𝐿𝑎𝑠𝑡𝐵𝑦𝑡𝑒𝑅𝑐𝑣𝑑 − 𝐿𝑎𝑠𝑡𝐵𝑦𝑡𝑒𝑅𝑒𝑎𝑑

Congestion control: Sender maintains a congestion window Cong𝑊𝑖𝑛

𝐿𝑎𝑠𝑡𝐵𝑦𝑡𝑒𝑆𝑒𝑛𝑡 − 𝐿𝑎𝑠𝑡𝐵𝑦𝑡𝑒𝐴𝑐𝑘𝑒𝑑 ≤ min {𝐶𝑜𝑛𝑔𝑊𝑖𝑛, 𝑅𝑐𝑣𝑊𝑖𝑛𝑑𝑜𝑤}

Sender updates Cong𝑊𝑖𝑛 under congestion.

How does TCP detect congestion or loss?

How to update the congestion window?

Congestion Detection/Control

How does TCP detect congestion or loss? Timeout, based on RTT

Received acknowledgements pattern

How to update the congestion window? AIMD

Slow Start (initial phase, after timeout)

RTT Estimation and Timeout

Exponential weighted moving average (𝛼 =1

8 )

𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒𝑑𝑅𝑇𝑇 = 1 − 𝛼 ⋅ 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒𝑑𝑅𝑇𝑇 + 𝛼 ⋅ 𝑆𝑎𝑚𝑝𝑙𝑒𝑅𝑇𝑇

Variability of RTT: 𝐷𝑒𝑣𝑅𝑇𝑇 with ( 𝛽 =1

4 )

𝐷𝑒𝑣𝑅𝑇𝑇 = 1 − 𝛽 ⋅ 𝐷𝑒𝑣𝑅𝑇𝑇 + 𝛽 ⋅ |𝑆𝑎𝑚𝑝𝑙𝑒𝑅𝑇𝑇 − 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒𝑑𝑅𝑇𝑇|

Timeout mechanism 𝑇𝑖𝑚𝑒𝑜𝑢𝑡𝐼𝑛𝑡𝑒𝑟𝑣𝑒𝑙 = 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒𝑑𝑅𝑇𝑇 + 4𝐷𝑒𝑣𝑅𝑇𝑇

Exponential growth after consecutive timeouts, by doubling the 𝑇𝑖𝑚𝑒𝑜𝑢𝑡𝐼𝑛𝑡𝑒𝑟𝑣𝑒𝑙

Cumulative and Duplicate ACK

Ack the lowest expected sequence number

Use cumulative ACK given in-order packets Wait 500ms in practice

Duplicate ACK sent when Arrival of out-of-order packets with higher-

than expected sequence number

When a packet is lost, one can expect to receive multiple duplicate ACKs Timeout can be long before retransmission

Duplicate ACKs can be used to infer packet loss

State Transitions (Dynamics)

Two parameters: CongWin and Threshold

Two states (behavior under no congestion) 1. Slow start (SS):

• CongWin doubles in each round

• Transition to CA after reaching Threshold

2. Congestion avoidance (CA): • CongWin increases additively

Two transition events (under congestion) 1. Timeout (TO): CongWin=1; transition to SS

2. Triple Duplicate ACKs (TD): CongWin/=2; transition to CA

Threshold/=2 in either of the above

Updating 𝐶𝑜𝑛𝑔𝑊𝑖𝑛

Start with sending 𝑊 packets, which is the size of congestion window

Additive Increase: increase the congestion window size by 1/𝑊 for each ACK received

Slow Start: increase the congestion window size by 1 for each ACK received

Loss Detection (TCP Tahoe)

Triple Duplicates (TD)

Time-outs (TO)

TCP Reno (Fast Recovery)

References

J. Padhye, V. Firoiu, D. Towsley, J. Kurose, "Modeling TCP Reno Performance: A Simple Model and its Empirical Validation", IEEE/ACM Transactions on Networking, Vol. 8, No. 2, April 2000.

Z. Chen, T. Bu, M. Ammar, and D. Towsley, “Comments on ‘Modeling TCP Reno Performance: A Simple Model and its Empirical Validation’ ", IEEE/ACM Transactions on Networking, Vol. 14, No. 2, April 2006.

What Does A Model Tell?

Steady-state send rate (throughput) of TCP Reno, defined by 𝐵.

As a function of Loss Rate 𝑝

Average Round Trip Time (RTT) E[𝑟]

Number of cumulated packets 𝑏 received until an ACK is sent

Notation

𝑁𝑡 : # of packets transmission in [0, 𝑡]

Long-term steady-state throughput

𝐵 = lim𝑡→∞

𝐵𝑡 = lim𝑡→∞

𝑁𝑡𝑡

A TD period (TDP) is defined as the time between two TD loss indications

𝑌𝑖 : # of packets sent in the 𝑖th TDP

𝐴𝑖 : duration of the 𝑖th TDP

𝑊𝑖 : size of the congestion window at the end of the 𝑖th TDP

Congestion Window Evolution

𝐵 =?

𝑌 1 𝑌 2 𝑌 3

Regenerative Process

Assumptions: Bulk transfer

Inter-round packet losses are independent

Correlated losses within a round: after a packet loss, all subsequent packets in the round are lost

Cumulative ACK: one ACK per 𝑏 packets received

{𝑊𝑖: 𝑖 = 1,2,⋯ } is a regenerative process with rewards 𝑌𝑖: 𝑖 = 1,2,⋯

𝐵 = E[𝑌]/E[𝐴]

More Observable Parameters

𝛼𝑖 : the first loss of packet

𝑋𝑖 : the round that the loss happens For each round, 𝐶𝑜𝑛𝑔𝑊𝑖𝑛 number of packets are

transmitted.

After receiving 𝐶𝑜𝑛𝑔𝑊𝑖𝑛 number of ACKs, the congestion window sizes increases by 1.

𝛽𝑖 : # of successfully received packet in round 𝑋𝑖

Packets Sent In Each TDP

Sample Path Facts

# of packets sent in the 𝑖th TDP (reward 𝑌𝑖) 𝑌𝑖 = 𝛼𝑖 − 1 +𝑊𝑖

Also by counting the packets pictorially,

𝑌𝑖 = 𝑊𝑖−1

2+ 𝑘 𝑏

𝑋𝑖𝑏 −1

𝑘=0

+ 𝛽𝑖

Change in congestion window:

𝑊𝑖 =𝑊𝑖−1

2+

𝑋𝑖𝑏− 1

Deriving E[𝑌]

𝑌𝑖 = 𝑊𝑖−1

2+ 𝑘 𝑏

𝑋𝑖𝑏 −1

𝑘=0

+ 𝛽𝑖

=𝑋𝑖𝑊𝑖−1

2+𝑋𝑖2

𝑋𝑖𝑏− 1 + 𝛽𝑖

=𝑋𝑖2

𝑊𝑖−1

2+𝑊𝑖 + 𝛽𝑖

⇒ E 𝑌 =E[𝑋]

2

E[𝑊]

2+ E[𝑊] + E[𝛽]

Expectations

E 𝑌 = E 𝛼 + E 𝑊 − 1

E 𝑌 =E[𝑋]

2

E[𝑊]

2+ E[𝑊] + E[𝛽]

E 𝑊 =E 𝑊

2+E 𝑋

𝑏− 1

𝛼 And 𝛽

Assumption of independent drops

∀𝑘 = 1,⋯ , P 𝛼 = 𝑘 = (1 − 𝑝)𝑘−1𝑝 ⇒ E 𝛼 = 1/𝑝

Assume ∀𝑘 = 1,⋯ ,𝑊𝑖 − 1, P 𝛽 = 𝑘 =1

𝑊𝑖

⇒ E 𝛽 =E 𝑊

2

Expectations (substitute 𝛼, 𝛽)

E 𝑌 =1

𝑝− 1 + E 𝑊

E 𝑌 =E[𝑋]

2

E[𝑊]

2+ E[𝑊] +

E 𝑊

2

E 𝑊 =E 𝑊

2+E 𝑋

𝑏− 1 ⇒ E 𝑋 =

𝑏

2E 𝑊 − 𝑏

Solutions

E 𝑊 =8(1 − 𝑝)

3𝑏𝑝+(3𝑏 − 2)2

9𝑏2−3𝑏 − 2

3𝑏

E 𝑌 =1 − 𝑝

𝑝+

8(1 − 𝑝)

3𝑏𝑝+(3𝑏 − 2)2

9𝑏2−3𝑏 − 2

3𝑏

E 𝑋 =2𝑏(1 − 𝑝)

3𝑝+(3𝑏 − 2)2

36+3𝑏 + 2

6

Packets Sent In Each TDP

Expressing E 𝐴

𝑟𝑖𝑗 : 𝑗th round trip time of the 𝑖th TDP

𝐴𝑖 = 𝑟𝑖𝑗

𝑋𝑖+1

𝑗=1

Assume 𝑟𝑖𝑗s are i.i.d. with mean E[𝑟]

𝑋𝑖 + 1 and 𝑟𝑖𝑗s are independent

⇒ E 𝐴 = E 𝑋 + 1 E[𝑟] (Wald’s equation)

Closed-form of 𝐵(𝑝)

Substitute E 𝑌 , E 𝐴 = E[𝑟](E 𝑋 + 1)

𝐵 𝑝 =

1 − 𝑝𝑝

+8(1 − 𝑝)3𝑏𝑝

+(3𝑏 − 2)2

9𝑏2−3𝑏 − 23𝑏

E[𝑟]2𝑏 1 − 𝑝

3𝑝+

3𝑏 − 2 2

36+3𝑏 + 26

Approximations (small 𝑝)

Mean congestion window size: E 𝑊 ≈8

3𝑏𝑝

Expected # of rounds: E 𝑋 ≈ E[𝑟]2𝑏

3𝑝

Average throughput: 𝐵(𝑝) ≈1

E[𝑟]

3

2𝑏𝑝

Time-outs Model

E 𝑀 = E 𝑌𝑖𝑗𝑛𝑖

𝑗=1+ E 𝑅 = E 𝑛 E 𝑌 + E 𝑅

E 𝑆 = E 𝐴𝑖𝑗

𝑛𝑖

𝑗=1

+ E 𝑍𝑇𝑂 = E 𝑛 E 𝐴 + E 𝑍𝑇𝑂

B = E 𝑀 /E 𝑆

Let 𝑄 ≝ 1/E 𝑛 ,

B =E 𝑀

E 𝑆=

E 𝑛 E 𝑌 + E 𝑅

E 𝑛 E 𝐴 + E 𝑍𝑇𝑂=

E 𝑌 + 𝑄E 𝑅

E 𝐴 + 𝑄E 𝑍𝑇𝑂

Need to determine (the new unknowns) 𝑄 : probability that a loss indication ending a

TDP is a timeout (TO)

E 𝑅 : number of failed retransmissions

E 𝑍𝑇𝑂 : avg. duration of a timeout sequence

Time-outs Model

P 𝑅 = 𝑘 = 𝑝𝑘−1 1 − 𝑝 ⇒ E 𝑅 =1

1−𝑝

The 𝑘th back-off time length is

𝐿𝑘 = 2𝑘 − 1 𝑇0 𝑘 ≤ 6

63 + 64 𝑘 − 6 𝑇0 𝑓𝑜𝑟 𝑘 ≥ 7

E 𝑍𝑇𝑂 = 𝐿𝑘P{𝑅 = 𝑘}∞

𝑘=1

= 𝑇01 + 𝑝 + 2𝑝2 + 4𝑝3 + 8𝑝4 + 16𝑝5 + 32𝑝6

1 − 𝑝

Solving E[𝑅] and E[𝑍𝑇𝑂]

Solving 𝑄

Let 𝑄 𝑤 be the value of 𝑄 conditioning on 𝑊 = 𝑤, the congestion window size in the penultimate (second last) round.

𝑄 𝑤 =

1, 𝑤 ≤ 3

𝐴(𝑤, 𝑘)2

𝑘=0+ 𝐴 𝑤, 𝑘 ℎ

𝑤

𝑘=3, 𝑤 > 3

𝑄 = 𝑄 𝑤 P{𝑊 = 𝑤}∞𝑤=1 = E 𝑄 ≈ 𝑄 E[𝑊]

Packets Sent In Each TDP

Loss Probabilities 𝐴(𝑤, 𝑘) and ℎ

Let 𝐴 𝑤, 𝑘 be the probability that only the first 𝑘 packets are ACKed in the penultimate round by the receiver

𝐴 𝑤, 𝑘 ≝1 − 𝑝 𝑘𝑝

1 − 1 − 𝑝 𝑤

The probability that the loss of packets in the last round happens in the first 3 packets

ℎ ≝ 𝑝 + 1 − 𝑝 𝑝 + 1 − 𝑝 2𝑝