Friday, September 23, 2016

Bandwidth Throttling Using Fiddler

Fiddler is a powerful debugging proxy server. One of the many uses of fiddler is to control or limit the network bandwidth available on your PC. This comes very handy for the scenarios when your app/website/ product etc needs to be tested in low internet connection.

Let's see how it can be done.

Prerequisite: 

Fiddler should be installed and ready to use.

Steps

  • Open Fiddler.
  • Go to Rules -> Customize Rules..  option in the top menu.
   
  • CustomRules.js will open by itself.
  • Try to locate "request-trickle-delay" in the opened file by using "Ctrl+F" keys
  • The associated code block should be something like:
          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"; 
        }

In the above code, change the value of "request-trickle-delay" to get the desired limited upload speed. Similarly, change the value of "response-trickle-delay" to get the desired limited download speed.


Couple of things to note:


The above values i.e. 300 and 150 are in milliseconds and 
1 MBPS=1024 bits/second, which means 1024 bits get uploaded in 1000 ms.

Based on this, let's say if you need a speed of 0.5 Mbps or 512 kbps you need to set the delay to 2 ms (=1024/2).
Similarly, for a speed of 256 kbps you need to add a delay of 4 ms(=1024/4) and so on.

Let's see how the code would look like when we need a download speed of 512 kbps and upload speed of 256 kbps.


if (m_SimulateModem) {
            // Delay sends by 4ms per KB uploaded.
            oSession["request-trickle-delay"] = "4"; 
            // Delay receives by 2ms per KB downloaded.
            oSession["response-trickle-delay"] = "2"; 
        }

  • Make the above changes and save the file. Close it.
  • Navigate to Rules-> Performance -> "Simulate Modem Speeds", select the option "Simulate Modem Speeds".













All set. You will now receive the speed closer to what you have mentioned above.

Points to consider

  1. In most of the case the internet speed you have configured and the speed you will get after configuration may not match exactly. It would be fairly close to what you have mentioned.
  2. Try changing the different values and observe the speed you get, derive a pattern. This pattern will help you in setting up the close enough values for trickle delays.
  3. Make sure to enable the option "Simulate Modem Speeds" every time you make a change to CustomRules.js file. It automatically turns off every time you make a change to the CustomRules.js file.

Happy Throttling!!!

4 comments:

  1. Hello, Good Article you know your article it's useful me and Thanks for Sharing Information.
    WiFi Speed Test

    ReplyDelete

  2. Hello, Good Article you know your article it's useful me and Thanks for Sharing Information.
    WiFi Speed Test

    ReplyDelete

  3. Hello, Good Article you know your article it's useful me and Thanks for Sharing Information.
    WiFi Speed Test

    ReplyDelete