当前位置:网站首页>计算BDP值和wnd值
计算BDP值和wnd值
2022-07-25 05:36:00 【识途老码】
计算BDP值和wnd值
背景
优化网络,需要调节wnd窗口值的最佳值.但是找来找去却没有特别好理解的算法.给出的示例和自己计算的结果完整对不上.爆肝了几晚,终于把BDP和窗口值的计算方法搞明白了,配之后网络效率确实得到了提升.
发此博文希望能帮助小白理解计算过程,帮助到有需要的人.
BDP值算法
参考: https://docs.oracle.com/cd/E56344_01/html/E53803/gnkor.html
BDP简介:
带宽延迟乘积 (bandwidth delay product, BDP)
计算方法:Bandwidth-Delay Product = delay * bandwidth
带宽延迟乘积 = 延时 * 带宽
BDP = 宽带_字节_B * 延时_s
sndwnd和rcvwnd算法
sndwnd是发送窗口,对应上传;rcvwnd是接收窗口,对应下载.
计算方法:窗口值_字节_B = BDP / MTU
使用python计算窗口值
即使给出计算方法,第一次算也会绕的头晕,干脆直接写了python脚本,有需要的拿去直接计算吧.我个人认为注释写的还算清楚,希望需要的人能看懂哈.
""" 参考公式: BDP = 宽带_字节_B * 延时_s 窗口值_字节_B = BDP / MTU """
def wnd(带宽_兆比特_Mbit, 延时_s, MTU):
""" # 计算窗口值_字节_B :param 带宽_兆比特_Mbit: 传入带宽值(小b) :param 延时_s: 传入延时(s) :param MTU: 掺入mtu值(一般是1400) :return: 返回计算出的窗口值_字节_B """
# 128 = 1024 / 8 # kBtye换算Mbit的值是128
# 宽带_千字节_kBtye = 带宽_兆比特_Mbit * 128
宽带_千字节_kBtye = 带宽_兆比特_Mbit * 1024 / 8
# 宽带_字节_B 和 宽带_千字节_kBtye 的换算单位是1024
宽带_字节_B = 宽带_千字节_kBtye * 1024
BDP = 宽带_字节_B * 延时_s
# 窗口值_字节_B的单位是字节_B
窗口值_字节_B = BDP / MTU
print(f"BDP值是:{
int(BDP)}")
print(f"窗口值是:{
int(窗口值_字节_B)}")
if __name__ == '__main__':
带宽_兆比特_Mbit = 500
延时_s = 0.125
MTU = 1500
# 打印窗口值_字节_B
wnd(带宽_兆比特_Mbit, 延时_s, MTU)
边栏推荐
- Shenzhen on call test, subject 4 on call test, subject 3 theory, second theory on call test instructions
- 2020ICPC 江西省赛热身赛 E.Robot Sends Red Packets(dfs)
- 50 places are limited to open | with the news of oceanbase's annual press conference coming!
- Exchange 2010 SSL certificate installation document
- Array programming problem of CSDN programming challenge
- Leetcode 237. 删除链表中的节点
- LeetCode 15:三数之和
- Implement is by yourself_ convertible
- typora+PicGo+阿里云OSS 搭建以及报错解决【转载】
- 项目管理工具——项目开发者工具
猜你喜欢

Shenzhen on call test, subject 4 on call test, subject 3 theory, second theory on call test instructions

Linear algebra (3)
![Atof(), atoi(), atol() functions [detailed]](/img/5a/a421eab897061c61467c272f122202.jpg)
Atof(), atoi(), atol() functions [detailed]

Microservice - hystrix fuse

Unity接入ChartAndGraph图表插件

Wechat applet related operation examples

Single sign on (one sign on, available everywhere)

SystemVerilog中interface(接口)介绍

Win11 how to view the file explorer tab

传输线理论之相速、相位等的概念
随机推荐
微服务 - Hystrix 熔断器
How do novices open accounts for stock speculation? Is it safe for securities companies to open accounts online?
06. Libavdevice Library of ffmpeg
Thesis reading | which is the best multilingual pre training technology for machine translation? See the latest progress!
sqlilabs less-29
Leetcode 204. count prime numbers (wonderful)
出于数据安全考虑,荷兰教育部要求学校暂停使用 Chrome 浏览器
QT qtextedit setting qscrollbar style sheet does not take effect solution
1310_ Implementation analysis of a printf
ThreadLocal
FinClip实现微信授权登录的三种方案
js 页面增加过渡层
odoo14 | 关于状态栏statusbar关键词使用后显示异常及解决方法
Wechat applet related operation examples
Typera+picgo+ Alibaba cloud OSS setup and error reporting solution [reprint]
New discovery of ROS callback function
typora+PicGo+阿里云OSS 搭建以及报错解决【转载】
[typescript manual]
剖析kubernetes集群内部DNS解析原理
What are the ways to realize web digital visualization?