[zz]工具对比_模拟慢网速环境
2010年12月30日 9:39 P.M.

出于工作需要,有时候需要模拟用户的慢网速对产品做进一步测试&优化,目前有三个软件可以模拟慢网速:Fiddler,NetLimiter,Network Delay Simulator。应该还有更多好用的软件尚待发掘。

Fiddler 免费软件。模拟网速功能比较单一(Rules --> Performance --> Simulate Modem speed),选项较少,Fiddler仅是减缓带宽并未引入包丢失(后面的Network Delay Simulator加入了包丢失模拟)。且因为浏览器并发连接数问题,会造成(Http watch 或Firebug)测试结果的瀑布图不准。所以虽然有这个功能,咱们一般不用它。fiddler的亮点在另一方面

NetLimiter 共享软件,需要自己注册。准确的说是一款网络流量控制软件,通过它,你可以直接来控制每个程序对Internet的访问以及流量分配情况。这里有前人制作的图。

Network Delay Simulator  免费软件,下载地址 。我正在使用的,三种之中功能最强大,监听Network Interface Card (NIC)和TCP/IP stack之间的网络流量,可以模拟延时、带宽甚至丢包率,更精确地模拟慢网速环境。设置也很简单方便:输入带宽,点击Save Flow即可,如果你要模拟丢包,填下丢包率便行。见图。

还有更专业的~~~~

文工具推荐中指出Fiddler的“Simulate Modem Speeds”功能(Rules->Performance-> Simulate Modem Speeds)是延时,下面具体分析其实现:

Fiddler2\Scripts\SampleRules.js中设置脚本规则

static function OnBeforeRequest(oSession: Session)

{

if (m_SimulateModem){

// Delay sends by 300ms per KB uploaded.

oSession["request-trickle-delay"] = "300";

}

static function OnBeforeResponse(oSession: Session)

{

if (m_SimulateModem){

// Delay receives by 150ms per KB downloaded.

oSession["response-trickle-delay"] = "150";

}

实现代码则在Fiddler.exe中的ServerChatter类

public bool ResendRequest()

{

....

if (this.m_session["request-trickle-delay"] != null)

{

int iMS = int.Parse(this.m_session.oFlags["request-trickle-delay"]);

this.pipeServer.TrickleSend(0x400, iMS, this.m_session.oRequest.headers.ToByteArray(true, true, this._bWasForwarded && !this.m_session.isHTTPS));

this.pipeServer.TrickleSend(0x400, iMS, this.m_session.requestBodyBytes);

}

....

Fiddler.exe中的Session类

public bool ReturnResponse(bool bKeepNTLMSockets)

{

try

{

if ((this.oRequest.pipeClient != null) && this.oRequest.pipeClient.Connected)

{

if (this.oFlags["response-trickle-delay"] != null)

{

int iMS = int.Parse(this.oFlags["response-trickle-delay"]);

this.oRequest.pipeClient.TrickleSend(0x400, iMS, this.oResponse.headers.ToByteArray(true, true));

if (this.responseBodyBytes != null)

{

this.oRequest.pipeClient.TrickleSend(0x400, iMS, this.responseBodyBytes);

}

}

可以看到它们都用到了Fiddler.exe中类Pipe的函数TrickleSend,以下是其定义:

public void TrickleSend(int iSize, int iMS, byte[] data)

{

for (int i = 0; i < data.Length; i += iSize)

{

Thread.Sleep((int) (iMS / 2));

this.Send(data, i, iSize);

Thread.Sleep((int) (iMS / 2));

}

}

由此可见Fiddler.exe在请求和发送的每KB过程中都采取了延时模拟。关于延时,Issues with Time Warner Cable service in New York中有人说道”With the modem doing some QoS, it can maintain 150-300ms latency when uploading and downloading and the line remains pretty snappy.”,BT Highway中也有类似描述。作者给出了如下解释:These speeds were derived from a simple model of the effective throughput of a modem.You can adjust these to match any other connection speed you want, so long as such speed is slower than how you're actually connected to the network, of course.The neXpert plugin for Fiddler does response-time predictions using data from Microsoft Research.

文Fiddler无法模拟浏览器并发连接数限制,开启工具栏上的"Streaming"模式可以解决,但这样就打破了规则"Simulate Modem speeds",得出来的总体时间大幅缩短,此时Fiddler不仅延时了带宽还延时了浏览器并发连接。正如作者在所说:Fiddler仅是减缓带宽并未引入包丢失。

Speed Simulator看起来比Fiddler模拟的差不多(注意:多做几次测试,找一个稳定的结果,每次选择HttpWatch的Tools->Clear Cache and All Cookied清空MSIE):

本想用同样方法测试浏览器插件IE Throttle,结果它无法在x64 Windows XP SP2上的x86 IE中打开“IE Throttle Settings”。同类型的还有Firefox Throttle。

Network Delay Simulator(简称NetSim)采用Token Bucket和Leaky_bucket算法模拟真实网络并监听网卡和Tcp/IP之间的网络流量,详见Is there any forum for Net Simulator。显然,它采用的是网络包丢失模拟。但需要注意这款免费软件从version 0.9.129开始支持x86 Windows 到Win7,关于此软件任何问题可联系Andrew。

HP推荐ShunraVE Desktop的WAN emulation,使用运行在FreeBSD上的免费Dummynet。

ToDo:

HP Loadrunner的Speed Simulation如何?MS VSTS 2010的Network Emulation又如何?

由于测不准,我们得不到准确的结果,但可以得到尽可能精确的结果。比如modem,你能确定国内中国电信、中国网通等ISP提供给终端用户的无论何时何地都是标准的速度56k吗?也许Keynote、Gomez所提供的服务,Google Analytics、Omniture、Webtrends、WebPagetest,运营监控是一种弥补措施。  【关于Fiddler其它】 1. 通过WinINET设置Proxy转发给127.0.0.1:8888 public bool Attach()
{
    if (!this._bIsAttached)
    {
        this.oAllConnectoids = new WinINETConnectoids();
        this.piPrior = this.oAllConnectoids.GetDefaultConnectionGatewayInfo();
        if ((this.piPrior.sHttpProxy != null) && this.piPrior.sHttpProxy.Contains(CONFIG.sFiddlerListenHostPort))
        {
            this.piPrior.sHttpProxy = null;
            this.piPrior.sHttpsProxy = null;
            this.piPrior.bUseManualProxies = false;
            this.piPrior.bAllowDirect = true;
        }
        if (CONFIG.bForwardToGateway && ((this.piPrior.sPACScriptLocation != null) || this.piPrior.bAutoDetect))
        {
            this.oAutoProxy = new WinHTTPAutoProxy(this.piPrior.bAutoDetect, this.piPrior.sPACScriptLocation);
        }
        if (CONFIG.bForwardToGateway && this.piPrior.bUseManualProxies)
        {
            this._ipepHttpGateway = Utilities.IPEndPointFromHostPortString(this.piPrior.sHttpProxy);
            this._ipepHttpsGateway = Utilities.IPEndPointFromHostPortString(this.piPrior.sHttpsProxy);
            this._ipepFtpGateway = Utilities.IPEndPointFromHostPortString(this.piPrior.sFtpProxy);
            if (this.piPrior.sHostsThatBypass != null)
            {
                this.oBypassList = new ProxyBypassList(this.piPrior.sHostsThatBypass);
                if (!this.oBypassList.HasEntries)
                {
                    this.oBypassList = null;
                }
            }
        }
        else
        {
            this._ipepFtpGateway = this._ipepHttpGateway = this._ipepHttpsGateway = null;
        }
        WinINETProxyInfo oNewInfo = new WinINETProxyInfo();
        if (CONFIG.bHookWithPAC)
        {
            oNewInfo.bAllowDirect = true;
            oNewInfo.sPACScriptLocation = "file://" + CONFIG.GetPath("Pac");
        }
        else
        {
            oNewInfo.bUseManualProxies = true;
            oNewInfo.bAllowDirect = true;
            oNewInfo.sHttpProxy = CONFIG.sFiddlerListenHostPort;
            if (CONFIG.bCaptureCONNECT)
            {
                oNewInfo.sHttpsProxy = CONFIG.sFiddlerListenHostPort;
            }
            else
            {
                oNewInfo.sHttpsProxy = this.piPrior.sHttpsProxy;
            }
            if (this.piPrior.bUseManualProxies)
            {
                oNewInfo.sFtpProxy = this.piPrior.sFtpProxy;
                oNewInfo.sSocksProxy = this.piPrior.sSocksProxy;
            }
            if (CONFIG.bCaptureFTP)
            {
                oNewInfo.sFtpProxy = CONFIG.sFiddlerListenHostPort;
            }
            oNewInfo.sHostsThatBypass = CONFIG.sHostsThatBypassFiddler;
        }
        if (this.oAllConnectoids.HookConnections(oNewInfo))
        {
            this._bIsAttached = true;
            FiddlerApplication.OnFiddlerAttach();
            this.WriteAutoProxyPACFile(true);
        }
        else
        {
            FiddlerApplication.DoNotifyUser("Failed to register Fiddler as the system proxy.", "Error");
            _setDynamicRegistryKey(false);
            return false;
        }
        _setDynamicRegistryKey(true);
    }
    return true;
}  2.DNSTime Fiddler.exe函数HTTPSTunnel.TunnelDirectly,Session.ExecuteHTTPSConnect,ServerChatter.ConnectToHost和ServerChatter.ConnectToHost中:
int num3 = Environment.get_TickCount();
iPAddress = DNSResolver.GetIPAddress(str2, true);
this.m_session.Timers.DNSTime = Environment.get_TickCount() - num3;

模拟丢包、慢网速的测试工具相关推荐

  1. 检测网络是否稳定的计算机命令,怎么看电脑上网络丢包 查看网速有没稳定和网络是否延时方法...

    上网经常卡,玩网络游戏跳ping,延迟400ms很可能是你家的网络问题.那么,电脑上怎么看网络丢包?今天小编就来教大家如何查看自家的网络延时问题.对于一些网络游戏来说,对网速与稳定性要求很高,而一旦网 ...

  2. 测试宝典---iptables 模拟丢包

    先列下常见的参数: 1.查看 iptables -nvL --line-number -L 查看当前表的所有规则,默认查看的是filter表,如果要查看NAT表,可以加上-t NAT参数 -n 不对i ...

  3. win8网速怎么测试软件,Windows8小技巧:查看当前网速

    我们在使用电脑的过程中,有时候会因为一些原因要查看电脑的网速.在WIN8系统中,上网的时候发现速度特别慢,这个时候我们可以用cmd的ping命令查网速,是否掉线等情况,准确率高.那么具体怎么做呢?下面 ...

  4. 电脑上传网速怎么测试软件,宽带上传速度怎么测试 教你如何看电脑宽带上传速度...

    网速一般分为下载速度和上传速度,一般我们测算网速只是测试下载速度,只要电脑从网上下载速度快,用户通常比较满意.但你知道吗?上传速度也是值得关注的,尤其是在云网络时代,很多朋友都要传文件到网盘或者视频网 ...

  5. 台式计算机的计算速度,台式机网速如何测试

    我的台式机想测试下网速,那么用什么测试好呢?下面由学习啦小编给你做出详细的台式机网速测试方法介绍!希望对你有帮助! 台式机网速测试方法一: 测试路由器和电脑之间的速度步骤如下: 1.以360安全卫士为 ...

  6. python socket通信 recv 丢包_用clumsy模拟丢包测试socket库的失败重传

    用python的socket库写了通信小程序,现在我需要通过软件模拟出在网络极差的情况下,socket底层解决丢包问题的能力怎么样,我一开始想的是分别在linux和windowns下分别测试,后来一想 ...

  7. 苹果网速4g测试软件,‎App Store 上的“测网速 - SpeedTest 网速测试大师”

    测网速源于为了让人们更快更好的了解自己当前的网速. [简单.方便.快速.准确]是我们设计理念. 测网速至今已通过数千亿次测试使用,整个互联网行业的专家们同样信任它提供的测量结果.测试从未如此简单易用美 ...

  8. Jmeter——Jmeter限制网速进行测试

    一.业务需要,有时限制网速会更加符合实际,测试出真实的响应时间情况 找到apache-jmeter-3.2/bin/jmeter.properties文件 找到参数,分别为限制http即https # ...

  9. 高通410随身WiFi-SP970-V13的网速极限测试和开adb去云控及其它设置

    然后听说格行新V13的wifi支持5ghz,我很感兴趣就买了一个,体验下来确实厉害,在我看来,70元以内这是最强的棒子了,信号好 网速快 热点WiFi也很强. 不过现在没有合适的渠道,我购买的那家店会 ...

最新文章

  1. iOS快速上手应用内购(IAP)附Demo
  2. python转cython_用Cython加速Python到“起飞”(推荐)
  3. javascript正则表达式小结
  4. 看看HashSet源码
  5. [简单题]自定义取余(三种解法)C++实现
  6. linux——虚拟机的图形安装、管理以及快照
  7. Redis RDB、AOF持久化详解
  8. Python面试题(四)
  9. Xss Csrf 简介
  10. BeetleX之XRPC远程委托调用
  11. 工作328:uni-两个页面对象传递
  12. 程序员找工作防止小破公司的画饼充饥方法
  13. Android三种左右滑动效果 手势识别(转)
  14. java服务写在哪里_【Java学习笔记】如何写一个简单的Web Service
  15. Windows Server2019 安装教程
  16. 小米获取屏幕高度不准确-小米获取屏幕高度的兼容方案
  17. Arduino Pulsesensor脉搏心率的检测
  18. spring boot oauth2 facebook
  19. vs2005操作word详解
  20. Educoder_Web_移动端电商页面制作

热门文章

  1. 学历的事情,你要反省,太没有效率,太托,托墨迹,太没有决断力,太TM纠结了。
  2. repost 双非本科到腾讯的编程奋斗之路
  3. VS2017 出现Miscellaneous Files
  4. Unity Shader之磨砂玻璃与水雾玻璃效果
  5. 人工智能应用于心电图:这6篇论文值得收藏
  6. 地球引擎初级教程——JavaScript 简介(一文读懂如何使用GEE)
  7. Ag-Grid React入门
  8. 一篇评价牛顿的搞笑文章,作者老罗,但很有才
  9. CFSSL: 证书管理工具:3:使用CA私钥与证书签发证书
  10. 反骨之Java是如何解决并发中的可见性问题的