fiddler工具
调整上传/下载速率
打开fiddler脚本工具,在上方状态栏选择 Rules -> Customize Rules…,打开ScriptEditor编辑器
修改上传/下载速率,实现模拟指定弱网环境
计算公示:[1/(上或下行速率/8)] x 1000
网络 | 上行 | 下载 |
---|---|---|
2G | 2.7K | 9.6K |
3G | 1.8M | 7.2M |
4G | 50M | 100M |
如2G上传速度为2.7k,带入公式[1 / ( 2.7 / 8 )] * 1000 = 2,962,下载速度为[ 1 / ( 9.6 / 8 )]* 1000 = 833
不同的运营商(联通、移动、电信)的上行/下载速率速率有所不同,根据需要选择其上行/下载速率来设置参数
2G网络
if (m_SimulateModem) {// Delay sends by 300ms per KB uploaded.oSession["request-trickle-delay"] = "3000"; // Delay receives by 150ms per KB downloaded.oSession["response-trickle-delay"] = "1000"; }
3G网络
if (m_SimulateModem) {// Delay sends by 300ms per KB uploaded.oSession["request-trickle-delay"] = "20"; // Delay receives by 150ms per KB downloaded.oSession["response-trickle-delay"] = "10"; }
修改后,退出编辑器,在fiddler上方状态栏选择:Rules->Performance->勾选 Simulate Modem Speeds,启动弱网模拟
谷歌浏览器
按F12打开开发者工具窗口,选择网络,点击【已停用节流模式】下拉框,勾选所需网络环境即可模拟改网络环境
如无所需模拟环境,可通过 自定义->添加 来自定义模拟环境