40

I am using Fiddler and want to simulate different network speeds

Is there any published data that I can use to simulate different speeds using the delay value ?

Following is default code of Fiddler to simulate 56kb modem speed.

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

I want the delay values for 256kbps, 512kbps, 1Mbps etc...

anton.burger
  • 5,637
  • 32
  • 48
aneez
  • 693
  • 1
  • 7
  • 18
  • 16
    If you came here looking for throttling in fiddler as I did, note the above JavaScript code can be found by clicking the Rules menu ==> Customize Rules... Then find the text 'm_simulateModem' near line 189. Adjust these values to delay each Kb of data by x milliseconds. – Zymotik Feb 03 '15 at 16:01
  • 3
    @Zymotik - thanks for the shortcut - another tip for those adjusting these values for throttling - every time you save CustomRules.js Fiddler will turn off the Rules | Performance | Simulate Modem Speeds flag. You need to turn it back on if you want your new upload/download delays to apply. – Drew Aug 31 '15 at 01:04
  • @Zymotik & Drew: Thanks for those comments, that really helped me, as I couldn't work out how to change the speeds and then why they were not taking effect. – Karl Gjertsen Mar 23 '16 at 11:01

3 Answers3

48

This is simply a math problem.

Assuming that content is available instantly (e.g. you're playing it back from the AutoResponder) then the only delay is controlled by request-trickle-delay and response-trickle-delay flags.

There are 1000 milliseconds per second.

So, if you want to gate the connection to 1 megabyte per second, you would use a delay of 1 ms. If you want to gate it to 512 kilobyte per second, then use a delay of 2 ms. For 256 kilobytes per second, use a delay of 4 ms.

Keep in mind that bandwidth is often measured in bits per second rather than bytes per second. So if your goal is to measure things in bits-per-second, then multiply each value by 8.

EricLaw
  • 56,563
  • 7
  • 151
  • 196
  • 2
    Thanks Eric. I guess this plugin for Fiddler does the same: http://www.logic-worx.com/index.php/tools-and-apps/fiddler-connection-simulator/ – aneez May 02 '13 at 11:02
  • 10
    Can't beat getting an answer from the man who wrote the software! This is one of the reasons I love SO... – Jim Jan 23 '14 at 17:18
  • Is it possible to set fractional trickle delays? I tried setting to "0.5" to get 2056KBs and it seemed to lock up the connection. – sleep May 07 '15 at 02:57
  • 1
    @JarrodSmith: Not today, no; Fiddler interprets the value as an Integer. I expect Fiddler's bandwidth-emulation features to get richer in the future. – EricLaw May 08 '15 at 18:56
38

I made changes to request-trickle-delay and response-trickle-delay that EricLaw Recommended. I used SpeedTest.Net to valaidate the changes I made. They didn't match up perfectly. For example I expected that if I set Trickle Delay values to 8 I would get download speed of 1 Mbps, but actually got 2.05 Mbps. Based on EricLaw's answer at least I was able to identify a pattern. Thanks Eric.

After each change to the Fiddler CustomerRule.js file I re-enabled "Simulate Modem Speed". FYI, when you make a change to the CustomerRule.js file the "Simulate Modem Speed" is disabled. So you must re-enable the setting.

I added a few images of results from SpeedTest.net.

Below are the results for each setting change:

enter image description here

Fiddler Settings

enter image description here

Here I set request-trickle-delay and response-trickle-delay to 16. As you can see I received 1.03 Mbps

enter image description here

Here I set request-trickle-delay and response-trickle-delay to 32. As you can see I received 0.52 Mbps

enter image description here

Community
  • 1
  • 1
Mike Barlow - BarDev
  • 11,087
  • 17
  • 62
  • 83
  • 2
    How did you managed to affect speedtest.net using Fiddler? In my case it affect webpages download, images download etc., [but not speedtest.net](http://stackoverflow.com/a/39863388/2594597) – Leonid Vasilev Nov 01 '16 at 12:35
  • @Leonid Vasilyev In Firefox you have to set up proxy manually. Automatic detection doen't work. – The incredible Jan Mar 24 '17 at 12:48
  • 3
    When experimenting with the script's settings you can change the `m_SimulateModem` declaration to default to `true` so it is enabled after the script loads. Just remember to turn it back to `false` after you're done. – Corey May 29 '17 at 04:37
1

Old post but I wanted to add some information here to make Fiddler throttling a little more user friendly. We are going to create a new menu under Rules with a bunch of modem speeds to select.

Click Rules -> Customize Rules option

Customize Rules menu option (CTRL+R)

Search for the declaration of m_SimulateModem which looks like:

public static var m_SimulateModem: Boolean

and replace it with a RulesString.

    // Cause Fiddler Classic to delay HTTP traffic to simulate typical modem conditions
    RulesString("Simulate &Modem Speeds", true) 
    BindPref("fiddlerscript.ephemeral.ModemSpeed")
    RulesStringValue(0,"5&6 kbps", "56")
    RulesStringValue(1,"&128 kbps", "128")
    RulesStringValue(2,"&256 kbps", "256")
    RulesStringValue(3,"&512 kbps", "512")
    RulesStringValue(4,"1 &mbps", "1m")
    public static var m_SimulateModem: String = null;

Search the rules again for m_SimulateModem, we are looking for the if statement where trickle is applied. Remove the if block and swap it for the following case statement:

switch (m_SimulateModem) {

    case "56": // 56kbps
        oSession["request-trickle-delay"] = "760"; 
        oSession["response-trickle-delay"] = "440";         
        break;
    
    case "128": // 128kbps
        oSession["request-trickle-delay"] = "380"; 
        oSession["response-trickle-delay"] = "220";             
        break;
    
    case "256": // 256kbps
        oSession["request-trickle-delay"] = "190"; 
        oSession["response-trickle-delay"] = "110";         
        break;
    
    case "512": // 512kbps
        oSession["request-trickle-delay"] = "95"; 
        oSession["response-trickle-delay"] = "55";          
        break;
    
    case "1m": // 1 mbps
        oSession["request-trickle-delay"] = "46"; 
        oSession["response-trickle-delay"] = "27";          
        break;
    
    case null:          
    default:
        break;
}

Save your rules file. You will now have an option under Rules -> Simulate modem speeds with various throttling options:

Throttling speeds to 512kbps

The numbers have been massaged using Speed Test to get close to the desired speeds in real life.

Speed Test showing 512kbps throttling

Bonus points: try viewing your favourite internet sites with throttling at 56kbps.

Wolfwyrd
  • 15,716
  • 5
  • 47
  • 67