成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

基于UDP傳輸協(xié)議的實(shí)現(xiàn)分析之流量和擁塞控制

網(wǎng)絡(luò) 網(wǎng)絡(luò)管理
基于UDP的數(shù)據(jù)傳輸協(xié)議是一種互聯(lián)網(wǎng)數(shù)據(jù)傳輸協(xié)議。UDT的主要目的是支持高速廣域網(wǎng)上的海量數(shù)據(jù)傳輸,而互聯(lián)網(wǎng)上的標(biāo)準(zhǔn)數(shù)據(jù)傳輸協(xié)議TCP在高帶寬長距離網(wǎng)絡(luò)上性能很差。

流量控制

對(duì)于一個(gè)帶寬1Gbps, RTT為100ms的網(wǎng)絡(luò)來說

BDP=1,000,000,000*0.1/8=12,500,000字節(jié)=12207K=12M

傳統(tǒng)TCP接收窗口大小=65535byte=64K, 顯然滿足不了

udt使用包大小1500byte, 默認(rèn)接口窗口大小為8192, 因此

接收窗口的大小為=1500*8192=12,288,000字節(jié)=12000K=11.7M

因此, 可以看到udt的默認(rèn)設(shè)置已經(jīng)足夠.

Congestion Control(擁塞控制)

1. 兩個(gè)重要的參數(shù):

congestion window size and the inter-packet sending interval

2. 主要的接口

1) init: when the UDT socket is connected.

2) close: when the UDT socket is closed.

3) onACK: when ACK is received.

4) onLOSS: when NACK is received.

5) onTimeout: when timeout occurs.

6) onPktSent: when a data packet is sent.

7) onPktRecv: when a data packet is received.

3. udt的擁塞算法:

On ACK packet received:

1) If the current status is in the slow start phase, set the

congestion window size to the product of packet arrival rate and

(RTT + SYN). Slow Start ends. Stop.

2) Set the congestion window size (CWND) to: CWND = A * (RTT + SYN) +16.

3) The number of sent packets to be increased in the next SYN period

(inc) is calculated as:

if (B <= C)

inc = 1/PS;

else

inc = max(10^(ceil(log10((B-C)*PS*8))) * Beta/PS, 1/PS);

where B is the estimated link capacity and C is the current

sending speed. All are counted as packets per second. PS is the

fixed size of UDT packet counted in bytes. Beta is a constant

value of 0.0000015.

4) The SND period is updated as:

SND = (SND * SYN) / (SND * inc + SYN).

Java代碼

  1. Java代碼   
  2. */   
  3.     public void onACK(long ackSeqno){   
  4.         //increase window during slow start   
  5.         if(slowStartPhase){   
  6.             congestionWindowSize+=ackSeqno-lastAckSeqNumber;   
  7.             lastAckSeqNumber = ackSeqno;   
  8.             //but not beyond a maximum size   
  9.             if(congestionWindowSize>session.getFlowWindowSize()){   
  10.                 slowStartPhase=false;   
  11.                 if(packetArrivalRate>0){   
  12.                     packetSendingPeriod=1000000.0/packetArrivalRate;   
  13.                 }   
  14.                 else{   
  15.                     packetSendingPeriod=(double)congestionWindowSize/(roundTripTime+Util.getSYNTimeD());   
  16.                 }   
  17.             }   
  18.    
  19.         }else{   
  20.             //1.if it is  not in slow start phase,set the congestion window size   
  21.             //to the product of packet arrival rate and(rtt +SYN)   
  22.             double A=packetArrivalRate/1000000.0*(roundTripTime+Util.getSYNTimeD());   
  23.             congestionWindowSize=(long)A+16;   
  24.             if(logger.isLoggable(Level.FINER)){   
  25.                 logger.finer("receive rate "+packetArrivalRate+" rtt "+roundTripTime+" set to window size: "+(A+16));   
  26.             }   
  27.         }   
  28.    
  29.         //no rate increase during slow start   
  30.         if(slowStartPhase)return;   
  31.    
  32.         //no rate increase "immediately" after a NAK   
  33.         if(loss){   
  34.             loss=false;   
  35.             return;   
  36.         }   
  37.    
  38.         //4. compute the increase in sent packets for the next SYN period   
  39.         double numOfIncreasingPacket=computeNumOfIncreasingPacket();   
  40.    
  41.         //5. update the send period   
  42.         double factor=Util.getSYNTimeD()/(packetSendingPeriod*numOfIncreasingPacket+Util.getSYNTimeD());   
  43.         packetSendingPeriod=factor*packetSendingPeriod;   
  44.         //packetSendingPeriod=0.995*packetSendingPeriod;   
  45.    
  46.         statistics.setSendPeriod(packetSendingPeriod);   
  47.     }   

On NAK packet received:

1) If it is in slow start phase, set inter-packet interval to

1/recvrate. Slow start ends. Stop.

2) If this NAK starts a new congestion period, increase inter-packet

interval (snd) to snd = snd * 1.125; Update AvgNAKNum, reset

NAKCount to 1, and compute DecRandom to a random (average

distribution) number between 1 and AvgNAKNum. Update LastDecSeq.

Stop.

3) If DecCount <= 5, and NAKCount == DecCount * DecRandom:

a. Update SND period: SND = SND * 1.125;

b. Increase DecCount by 1;

c. Record the current largest sent sequence number (LastDecSeq).

Java代碼

  1. /* (non-Javadoc)  
  2.     * @see udt.CongestionControl#onNAK(java.util.List)  
  3.     */   
  4.    public void onLoss(List<Integer>lossInfo){   
  5.        loss=true;   
  6.        long firstBiggestlossSeqNo=lossInfo.get(0);   
  7.        nACKCount++;   
  8.        /*1) If it is in slow start phase, set inter-packet interval to  
  9.             1/recvrate. Slow start ends. Stop. */   
  10.        if(slowStartPhase){   
  11.            if(packetArrivalRate>0){   
  12.                packetSendingPeriod = 100000.0/packetArrivalRate;   
  13.            }   
  14.            else{   
  15.                packetSendingPeriod=congestionWindowSize/(roundTripTime+Util.getSYNTime());   
  16.            }   
  17.            slowStartPhase = false;   
  18.            return;   
  19.        }   
  20.    
  21.        long currentMaxSequenceNumber=session.getSocket().getSender().getCurrentSequenceNumber();   
  22.        // 2)If this NAK starts a new congestion epoch   
  23.        if(firstBiggestlossSeqNo>lastDecreaseSeqNo){   
  24.            // -increase inter-packet interval   
  25.            packetSendingPeriod = Math.ceil(packetSendingPeriod*1.125);   
  26.            // -Update AvgNAKNum(the average number of NAKs per congestion)   
  27.            averageNACKNum = (int)Math.ceil(averageNACKNum*0.875 + nACKCount*0.125);   
  28.            // -reset NAKCount and DecCount to 1,   
  29.            nACKCount=1;   
  30.            decCount=1;   
  31.            /* - compute DecRandom to a random (average distribution) number between 1 and AvgNAKNum */   
  32.            decreaseRandom =(int)Math.ceil((averageNACKNum-1)*Math.random()+1);   
  33.            // -Update LastDecSeq   
  34.            lastDecreaseSeqNo = currentMaxSequenceNumber;   
  35.            // -Stop.   
  36.        }   
  37.        //* 3) If DecCount <= 5, and NAKCount == DecCount * DecRandom:   
  38.        else if(decCount<=5 && nACKCount==decCount*decreaseRandom){   
  39.            // a. Update SND period: SNDSND = SND * 1.125;   
  40.            packetSendingPeriod = Math.ceil(packetSendingPeriod*1.125);   
  41.            // b. Increase DecCount by 1;   
  42.            decCount++;   
  43.            // c. Record the current largest sent sequence number (LastDecSeq).   
  44.            lastDecreaseSeqNocurrentMaxSequenceNumber;   
  45.        }   
  46.          
  47.        statistics.setSendPeriod(packetSendingPeriod);   
  48.        return;   
  49.    }   

 

責(zé)任編輯:林琳 來源: iteye.com
相關(guān)推薦

2010-06-10 15:14:32

TCP傳輸控制協(xié)議

2010-07-06 15:43:04

UDP協(xié)議

2020-07-23 15:01:15

TCP流量擁塞

2013-05-27 10:48:16

TCPUDP傳輸協(xié)議

2021-07-27 05:13:12

TCPUDP 擁塞

2021-03-09 07:38:15

Percona Xtr流量控制運(yùn)維

2021-12-14 11:01:44

TCPUDP網(wǎng)絡(luò)協(xié)議

2010-06-13 15:32:57

TCP協(xié)議

2010-07-08 14:13:15

UDP協(xié)議

2020-02-10 20:54:48

擁塞流量控制

2023-12-26 01:07:03

TCP擁塞控制

2010-09-06 09:43:46

TCPUDPAndroid

2010-06-09 11:38:37

傳輸層通信協(xié)議

2010-07-12 17:31:36

UDTUDP協(xié)議

2010-07-07 11:29:28

UDP協(xié)議特點(diǎn)

2022-02-15 08:30:04

TCP三次握手四次揮手

2016-12-13 08:45:48

2014-12-31 15:05:11

Android流量監(jiān)控

2023-03-04 13:43:31

云終端傳輸協(xié)議

2010-07-06 15:10:05

UDP協(xié)議
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)

主站蜘蛛池模板: 日日摸天天添天天添破 | 国产精品不卡 | 日韩电影一区二区三区 | 天天操夜夜操免费视频 | h片在线观看网站 | 国产在线一级片 | 日韩在线不卡视频 | 亚洲精品久久区二区三区蜜桃臀 | 成人在线视频看看 | 69精品久久久久久 | 久久久久国产 | 久久国产区 | 亚洲一区中文字幕在线观看 | 欧美成人一区二区三区 | 亚洲一区三区在线观看 | 亚洲成人中文字幕 | 中文字幕在线免费观看 | 麻豆视频国产在线观看 | 国产精品一区二区三区久久久 | 最新国产视频 | 一区二区三区韩国 | 亚洲激情自拍偷拍 | 久久国产精品视频 | 国产一区在线免费 | 欧美一区二区三区一在线观看 | 99九色| 一级美国黄色片 | 日韩av在线一区 | 国产精品久久久久久久久图文区 | 日韩欧美三区 | 国产一区久久精品 | caoporn免费在线视频 | 天堂久 | 日韩欧美三级 | 国产一区二区三区网站 | 欧美视频网 | 国产ts人妖系列高潮 | 免费艹逼视频 | 国产成人高清在线观看 | 国产激情精品视频 | 精品久久久久久亚洲综合网 |