Use fiddler weak network simulation environment

Weak network testing Background:

  The actual customer site network may be unstable or low speed, poor network environment can lead to some bug, test environment and development environment is relatively smooth network is difficult to reproduce this bug. To solve this problem, we need to create a weak network environment for testing, reproduce and fix the problem.

Use Fiddler weak network simulation environment:

  Fiddler is an HTTP debugging proxy that can record HTTP traffic, Fiddler between all your computers and the Internet also allows you to inspect all HTTP traffic, set breakpoints, and modifying all the "in and out" of data (refer to Cookie / HTML / JS / CSS files, etc.).

To simulate the harsh network environment, simple, more intuitive, only drawback is that it supports those services use HTTP to communicate and interact using Fiddler.

  Method a: Open Fiddler, the case where the default Rules -> Performances -> Simulate Modem Speeds state is unchecked, the network is normal. After this option is selected (analog optical cat network speed), speed will become very slow, open a web page to load for a long time. This realization of the weak network effect.

 

  Method Two: Implement a random delay

Click Rules - Customize Rules (shortcut Ctrl + R) to open the Fiddler ScriptEditor, or directly opening the right side of the home page to sign FiddlerScript. Find if (m_SimulateModem) statement, modify the code. The following script implements a random delay amount is set so that the network bandwidth is not constant at a low value, but will be within a certain range of random jitter:

 

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); }

上面两种方法选其一,修改后保存配置文件(Ctrl+S)或者清掉缓存(Rules –> Performances –>Disable Caching),再次勾选Rules –> Performances –> Simulate Modem Speeds 进行测速。注意:每次编辑并保存配置文件后,Simulate Modem Speeds选项会被取消,请重新勾选。
限速完毕一定要取消勾选,不然会影响上网。像第二种方法由于请求和响应都延迟3秒,会导致访问网页很慢。

参考文档https://www.jianshu.com/p/b9e349b8f411

 

Guess you like

Origin www.cnblogs.com/jiahm/p/11502562.html