基于网络请求轨迹的联合带宽预测算法

在DASH中,自适应码率控制是关键部分,其最终目标是最大程度地提高视频码率,同时最大程度地减少重缓冲导致的卡顿事件,而对于吞吐量的预测在帮助动态选择合适的视频码率方面发挥着重要的作用。由于现实世界中的网络情况是不断波动的,因此我们通常需要对多个网络传输链路的实时吞吐量进行大规模测试并统计分析。尽管文献[1]中已经提出了一种基于网络请求轨迹的算法并实现了仿真,但作者并没有在实际的网络视频传输中将其实现,而且该算法只考虑了单个请求源的情况。

考虑到我们平台中的码率自适应算法也需要考虑传输带宽,我们提出了一种全新基于网络请求轨迹的联合带宽预测算法,适用于多个并行、异步请求同时存在的情况下预测实时带宽。

提出方法:

基于网络请求轨迹的联合带宽预测的若干种情况分析

此处结合图例解释具体算法思路,其目的是获得一定时隙内的传输数据量及有效传输时间,然后相除得到该时隙的平均带宽:

  • 初始化时设定一个index为当前时隙的结束时间,totalData为0,totalTime为时隙时长;

  • 往前寻找离index时间最近的request(以request完成的时间为寻找目标),情况如(a)所示,totalData加上该request在该时隙内所传输的数据量,totalTime减去request完成后到时隙结束的时间(原因是这段时间没有参与传输),同时index更新为该request开始传输的时间;

  • 再往前寻找下一个request:

    • 若该request的开始时间大于index,如(b),则totalData加上该request在该时隙内所传输数据量,totalTime和index不变;

    • 若该request开始时间小于index且完成时间大于index,如(c),则totalData加上该request在该时隙内所传输数据量,totalTime不变,index更新为该request开始传输的时间;

    • 若该request完成时间小于index,如(d),则totalData加上该request在该时隙内所传输数据量,totalTime减去index和该request完成时间之差,index更新为该request开始传输的时间;

  • 注意当寻找到该时隙的最后一个request时,还要注意以下两种情况:

    • 若该request的开始时间大于时隙开始时间,则totalTime需要减去两者之差(原因是这段时间没有参与传输);

    • 若该request的开始时间小于时隙开始时间,则totalData只需要加上该request在当前时隙中传输的数据量即可;

  • 最终根据totalData和totalTime计算获得该时隙的平均传输带宽,然后经过一定的函数处理可用于预测未来带宽情况。

实现代码:

function computetotalThroughput() {
 const precurTime = new Date().getTime();  // Get current time
 const curTime = precurTime - $scope.requestLayBack;
 let TotalDataInAnInterval = 0;  // Byte
 let TotalTimeInAnInterval = $scope.requestDuration;  // ms
 let requestListLength = $scope.requestList.length;
 let requestListIndex = requestListLength - 1;
 let requestTimeIndex = curTime;
 while (requestListLength > 0 && requestListIndex >= 0) {
  let requestFinishTime = $scope.requestList[requestListIndex]._tfinish.getTime();
  let requestResponseTime  = $scope.requestList[requestListIndex].tresponse.getTime();
  if (requestFinishTime > curTime - $scope.requestDuration && requestResponseTime < curTime) {
   // Accumulate the downloaded data (Byte)
   let requestDownloadBytes = $scope.requestList[requestListIndex].trace.reduce((a, b) => a + b.b[0], 0);
   if (requestResponseTime > curTime - $scope.requestDuration) {
    if (requestFinishTime <= curTime) {
     TotalDataInAnInterval += requestDownloadBytes;
    } else {
     TotalDataInAnInterval += ( requestDownloadBytes * ( ( curTime - requestResponseTime ) / ( requestFinishTime - requestResponseTime ) ) );
    }
   } else {
    if (requestFinishTime <= curTime) {
     TotalDataInAnInterval += ( requestDownloadBytes * ( ( requestFinishTime - (curTime - $scope.requestDuration) ) / ( requestFinishTime - requestResponseTime ) ) );
    } else {
     TotalDataInAnInterval += ( requestDownloadBytes * ( $scope.requestDuration / ( requestFinishTime - requestResponseTime ) ) );
    }
   }
   // Subtract the free time (ms)
   if (requestTimeIndex > requestFinishTime) {
    TotalTimeInAnInterval -= (requestTimeIndex - requestFinishTime);
   }
   // More the time index forward
   if (requestTimeIndex > requestResponseTime) {
    requestTimeIndex = requestResponseTime;
   }
  }
  requestListIndex--;
 }
 if (curTime - $scope.requestDuration < requestTimeIndex) {
  TotalTimeInAnInterval -= (requestTimeIndex - (curTime - $scope.requestDuration));
 }
 if (TotalDataInAnInterval != 0 && TotalTimeInAnInterval != 0) {
  $scope.totalThroughput = Math.round((8 * TotalDataInAnInterval) / (TotalTimeInAnInterval / 1000));  // bps
 }
}

[1] B. Wei, H. Song, S. Wang, K. Kanai and J. Katto, "Evaluation of Throughput Prediction for Adaptive Bitrate Control Using Trace-Based Emulation," in IEEE Access, vol. 7, pp. 51346-51356, 2019, doi: 10.1109/ACCESS.2019.2909399.

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 一、计算机网络概述 1)基本概念 基本概念 ① 计算机网络就是一种通信网络② 计算机网络 = 通信技术 + 计算机...
    Du1in9阅读 3,578评论 0 18
  • 体系结构 计算机网络概念 一个将分散的、独立的系统通过通信设备和线路连接实现资源共享和信息传递的系统 组成与功能 ...
    strivexj阅读 1,132评论 0 0
  • 欢迎关注我的微信公众号:CurryCoder的程序人生 0.互联网的组成 边缘部分:所有连接在互联网上的主机(主机...
    CurryCoder阅读 1,592评论 0 6
  • 彩排完,天已黑
    刘凯书法阅读 4,331评论 1 3
  • 表情是什么,我认为表情就是表现出来的情绪。表情可以传达很多信息。高兴了当然就笑了,难过就哭了。两者是相互影响密不可...
    Persistenc_6aea阅读 126,223评论 2 7