36
1 TCP Congestion Control Rung-Shiang Cheng Department of Computer and Communication, Kun Shan University http://teachers.ksu.edu.tw/rscheng

TCP Congestion Control - KSU

  • Upload
    others

  • View
    14

  • Download
    0

Embed Size (px)

Citation preview

1

TCP Congestion Control

Rung-Shiang ChengDepartment of Computer and Communication, Kun Shan University

http://teachers.ksu.edu.tw/rscheng

TCP的主要功能

資料區段分割

提供連接導向的服務

提供可靠性的資料傳送服務

Flow control

Congestion control

– RFC 793

– RFC 2001, 2581

2

TCP擁塞控制基本方法

Slow-start

Congestion avoidance

Fast retransmit

Fast recovery

Timeout

3

擁塞控制的基本方法 (Congestion Control Mechanisms of TCP)

4

Fast

Recovery

Congestion

Avoidance

Slow

Start

triple dup-ACK

cwnd ≥

ssthresh

triple

dup-ACK

retransmit first

lost packet

new ACK

initial or

timeout Fast

Retransmit

expiry timer upon 1,

ACK) duplicate- triple(receive congestion if ,2/

if , ,/1

if , ,1

cwnd

ssthreshcwndcwndcwnd

ssthreshcwndcwnd

cwndavoidance Congestion

phase start-Slow

Timeout: ssthresh = cwnd/2, cwnd =1

傳送端

接收端

Tahoe TCP

Fast retransmit

– 收到n個duplicate ACK (通常是3個), 重送遺失的封包(加快重送的速度)

5

Reno TCP

目前最廣為使用的TCP版本

Fast recovry

– 傳送端在等待重送封包的ACK期間,仍可以繼續送出新的封包,藉以提高頻寛的的使用率

6

New-Reno TCP

修改Fast recovery機制

– 解決Reno在收到partial ACK時會提早結束Fast recovery

而導致TCP連線Timeout的問題

– 每個RTT時間內可重送一個遺失的封包.

7

1. 第7與第8個封包遺失2. 在收到3個duplicate-ACK後,cwnd

被重設為6 (3+3=6)3. cwnd + ack = 6 + 6 = 124. 在這個例子中,由於傳送端不會再

送出新的封包,因此只能等待timeout

SACK TCP

修改TCP的傳送端與接收端

在TCP header加入SACK選項

– 接收端在收到out-of-order packet時,會回傳目前已經收到的連續區段.

– 傳送端可藉由這些資訊得知那些packet沒被收到

8

TCP agent types in Ns-2

9

Agent Type Description

TCP A TCP Tahoe sender

TCP/Reno A TCP Reno sender

TCP/Newreno A TCP New Reno sender

TCP/Vegas A TCP Vegas sender

TCP/SACK1 A TCP sender with selective acknowledgments

TCPSink A TCP receiver that sends one ACK per packet

TCPSink/DelAck A TCP receiver with a configurable delay for ever

ACK

TCPSink/Sack1 A TCP receiver with selective ACKs

TCPSink/Sack1/DelAck A TCP receiver with Sack1 and DelAck

TCP Source 的設定參數

10

參數 說明fid_ TCP連線的號碼 (Flow ID)。window_ Advertised window的上限值 (upper bond)。Advertised

window有時也稱為receive window,其實指的就是接收端的緩衝區可以容納的封包個數。因此當Congestion window的值超過Advertised window時,TCP的傳送端會執行流量控制以避免送的太快而導致接收端的緩衝區溢滿 (overflow)。

maxcwnd_ Congestion window的最大值。windowInit Congestion window的初始值ecn_ True表示使用ECN。packetSize_ 傳送封包的資料大小。tcpTick_ TCP的timeout時間 (預設值為0.01秒)

maxburst_ 每收到一個ACK觸發傳送端最多能送出的封包個數。0表示關閉此選項功能。

TCP傳送端的狀態參數

11

參數 說明dupacks_ Duplicate ACK個數t_seqno_ 目前傳送的封包序號ssthresh_ Slow-start threshold的值cwnd_ Congestion window的值ack_ 傳送端最後收到的ACK序號maxseq_ 傳送端最後送出的封包序號

模擬架構圖

12

10,000,000 bps x 0.001 sec / 8 bits / 1,000 bits = 1.25 packets

1,000,000 bps x 0.004 sec / 8 bits / 1,000 bits = 0.5 packets

10,000,000 bps x 0.001 sec / 8 bits / 1,000 bits = 1.25 packets

(1.25 + 0.5 + 1.25) + 18 = 21 packets

TCL程式碼

13

TCL程式碼

14

cwnd_是TCP傳送端的狀態參數

TCL程式碼

15

執行範例

參數錯誤

參數錯誤

安裝Gnuplot

使用yum下載並安裝Gnuplot

17

模擬結果

18

19

模擬結果

模擬架構圖 (將buffer size變小)

20

故意把buffer size設小一點,觀察與前例的差異

21

22

觀察Bottleneck佇列長度的變化

23

觀察Bottleneck佇列長度的變化

24

觀察Bottleneck佇列長度的變化 (NewReno)

25

編號為32、34、36、38、40、42、44以及46

的封包在傳送的過程中遺失

q_lenaction seq_no time q_lenaction seq_no time

queue_length-newreno.tr檔的部份內容

觀察NewReno TCP的執行過程 (需自行修改/tcp/tcp-newreno.cc)

26

27

觀察封包被丟掉的個數

28

AWK程式碼(直接置於TCL程式碼中)

觀察封包被丟掉的個數 (以NewReno為例)

29

30

觀察SACK TCP的執行過程 (需自行修改/tcp/tcp-sack1.cc)

31

32

觀察Bottleneck佇列長度的變化 (SACK)

33

修改NS-2的原始碼

34

ns-2.31/tcp/

修改NS-2的原始碼

35

Makefile的內容

36