模拟丢包、慢网速的测试工具

[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的访问以及流量分配情况。这里有前人制作的图。

 

模拟丢包、慢网速的测试工具

 

 还有更专业的~~~~

工具推荐

     // 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”;

}

 

  {

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

                }

            }

 

    {

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

        this.Send(data, i, iSize);

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

    }

}

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. 

Speed Simulator

 

 

Network Delay Simulator推荐VE Desktop使用DummynetNetwork Emulation,我们得不到准确的结果,但可以得到尽可能精确的结果。比如KeynoteGomezGoogle AnalyticsOmnitureWebtrendsWebPagetest运营监控【关于Fiddler其它】1. 通过WinINET设置Proxy转发给127.0.0.1:8888public 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.DNSTimeint num3 = Environment.get_TickCount();
iPAddress = DNSResolver.GetIPAddress(str2, true);
this.m_session.Timers.DNSTime = Environment.get_TickCount() – num3;

来源:那美那美

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2012年6月16日
下一篇 2012年6月16日

相关推荐