当前位置:网站首页>Use of packet capturing tool Fiddler: simulating speed limit test process in weak network environment
Use of packet capturing tool Fiddler: simulating speed limit test process in weak network environment
2022-06-12 15:29:00 【fish_ study_ csdn】
One : Why do you want to be a weak network test ?
The actual customer site may have unstable network or low network speed , Bad network environment will lead to some problems bug, Some services are not even available . The internal R & D environment network of the company is usually relatively smooth , It's hard to reproduce this bug. To solve this problem , We need to test it in a weak network environment 、 Reproduce and fix problems .
Two : How to simulate bad network environment ?
This article only uses fiddler For example , Let's get to know the others , No specific study .
3、 ... and :Fiddler How to simulate a weak network ?
Fiddler It's a HTTP Debug agent , It can Record All your computers and Internet Between HTTP Communications ,Fiddler You can also check all HTTP Communications , To set breakpoints , And modify all “ In and out ” The data of ( finger Cookie/HTML/JS/CSS Wait for the documents ).
utilize Fiddler To simulate the bad network environment , Implement a simple , More intuitive , The disadvantage is that it can only support those who use HTTP Services for communication and interaction .
open fiddler, By default Rules –> Performances –> Simulate Modem Speeds Is unchecked , Normal network . Select this option ( Simulate optical cat network speed ) after , The network speed will become very slow , Opening a web page takes a long time to load . In this way, the weak network effect is realized .

Set up
If you want to know ( Upload and download ) The specific value of network speed , You can use a tool speedtest, The speed measurement method is very simple , There are lots of tutorials on the Internet .
http://www.speedtest.net/ It's an English website , It should be a foreign version , Slow access . and Windows The system only supports Windows10 Download client , I am using Windows7 Use chrome Browser to install Speedtest The extender has to go over the wall , So... Is not recommended . Suggest visiting http://www.speedtest.cn/ Website , The speed measurement results are fast and in Chinese . Support mobile phone client APP download .
Four : Speed limit principle
Fiddler The speed limit is realized in the form of network delay , Network latency * Network speed = Number of bytes transferred .
Click on Rules – Customize Rules( Shortcut key Ctrl + R) open Fiddler ScriptEditor, Or directly click on the home page on the right FiddlerScript.

After opening the file ,Ctrl + F lookup m_SimulateModem Sign a , You can see the following code :
if (m_SimulateModem) { // Delay sends by 300ms per KB uploaded. oSession["request-trickle-delay"] = "300"; // Delay receives by 150ms per KB downloaded. oSession["response-trickle-delay"] = "150"; }
annotated : request-trickle-delay The value in represents every KB How many milliseconds will be delayed when the data is uploaded ;response-trickle-delay It corresponds to every KB How many milliseconds will the data be delayed . For example, you need to simulate the upload speed 100KBps Network of , The upload delay is 1KB/100KBps=0.01s=100ms, Change to 100.
When checked Simulate Modem Speeds when ,request-trickle-delay And response-trickle-delay It will be set , If the network speed is already quite fast , The value set here can approximately calculate the upload and download bandwidth after the simulation is turned on , For example, the default upload delay is 300ms The download delay is 150ms, It can be calculated that the approximate analog bandwidth is :
Upload bandwidth =(1 * 8/1000) /0.300 ≈ 0.027Mbps
Download bandwidth =(1 * 8/1000) /0.150 ≈ 0.053Mbps
In practice, the bandwidth obtained may have errors , Affected by various external factors, it will not be so accurate .
It can be seen that the download bandwidth is twice that of upload , That is, the smaller the delay , More bandwidth . The bandwidth is inversely proportional to the delay here .
5、 ... and : Adjust network environment parameters
Fiddler default Simulate Modem Speeds The speed is too slow , The speed limit parameter can be adjusted , If you need to be faster, you can modify the configuration file Fiddler2ScriptsCustomRules.js.( Don't forget to back up the original file if you modify it ) stay fiddler Official website http://www.fiddlerbook.com/Fiddler/dev/ScriptSamples.asp Reference examples can be found .
Here are two simple ways to modify scripts , Choose one .
Method 1
Find the if (m_SimulateModem) sentence , Modify the code . The following script implements a random delay setting , So that the network bandwidth is not constant to a low speed value , It's a random jitter within a certain range :
static function randInt(min, max) { return Math.round(Math.random()*(max-min)+min);}if (m_SimulateModem) { // Delay sends by 300ms per KB uploaded. oSession["request-trickle-delay"] = ""+randInt(1,50); // Delay receives by 150ms per KB downloaded. oSession["response-trickle-delay"] = ""+randInt(1,50);}
Method 2
Click on fiddlerScript Find... In the code onBeforeRequest, This defines what to do before sending a request . Add the following code to achieve delay :
oSession["request-trickle-delay"]="3000"; // Request phase delay 3 second oSession["response-trickle-delay"]="3000"; // Response phase delay 3 second

Add code
Choose one of the above two methods , Save the configuration file after modification (Ctrl+S) Or clear the cache (Rules –> Performances –>Disable Caching), Check again Rules –> Performances –> Simulate Modem Speeds Speed measurement . Be careful : Every time you edit and save the configuration file ,Simulate Modem Speeds The option will be cancelled , Please check again .
After the speed limit is completed, be sure to uncheck , Otherwise it will affect the Internet . Like the second method, because the request and response are delayed 3 second , It will cause slow access to web pages .
边栏推荐
- Solution of user and root forgetting password in virtual machine
- Pta: self test -2 prime pair conjecture (20 points)
- Multi thread knowledge induction
- [jvm learning] virtual machine stack
- Distributed concurrent repeated submission
- PTA:自测-3 数组元素循环右移问题 (20分)
- RARP summary (tcp/ip explanation volume 1/2)
- CUDA out of memory or brokenpipeerror: [errno 32] broken pipe or oserror: [winerror 1455] solution to the problem that the page file is too small
- 任务 输出密雪冰城主题曲 0612
- Points chocolate (two points answer) Blue Bridge Cup provincial competition
猜你喜欢

Function recursion example

ROS beginners write the server that the little turtle rotates a certain angle at a certain speed

Acwing summer daily question (sexy prime number on June 10)

Idea大全(转载)

UDP总结(TCP/IP详解卷1/2)

增加mysql的最大连接数
![[LDA] LDA theme model notes - mainly Dirichlet](/img/e0/bc96b141aa577106379fab63d9df40.png)
[LDA] LDA theme model notes - mainly Dirichlet

Microservice fault tolerance

Deepin20.6 rtx3080 installer le lecteur de carte graphique 510.60.02, cuda 11.6, pytorch1.11

Kinect2.0+ORBSLAM2_with_pointcloud_map
随机推荐
vim的安装以及常用命令
Open Chinese path file in C language
Solutions to some problems of scuacm22 retreat competition before summer training
Summary of advantages and disadvantages of various architectures
FIRSTVT and LASTVT vernacular
Some useful websites
[game server design cases] insights
ROS初学者编写小乌龟以一定速度旋转一定角度的server
Task output: dense snow ice city theme song 0612
jupyter notebook新环境快捷方式
Leetcode daily question - fair candy bar exchange
3D reconstruction system | L3 dual view motion recovery structure (SFM binocular SFM)
Understanding of dart typedef
Simple crawler framework: parsing 51job page position information
Points chocolate (two points answer) Blue Bridge Cup provincial competition
使用CSDN-markdown编辑器
[untitled]
Change according to the situation, the road to promotion in the second half of 2022
IMU的学习记录
Instructions de soumission des tâches télécharger les tâches sur le disque réseau