Recently I’m working on a Silverlight business application that communicates with the server side using RIA web services. On the customer’s test system we experienced an unpleasant behavior in the asynchronous operations due to the slow response time of some background systems. In our development system we were not able to reproduce these issues.
Fortunately, Fiddler can help to emulate the slow server response times as well as slow network speeds.
Setting slow network speed is easy using the UI. One should check the Simulate Modem speeds option in Rules / Performance.
If you need to set custom speeds, you should modify the upload / download speeds (delay ms per KB) through the request-trickle-delay and response-trickle-delay session parameters (see these samples for details) in the CustomRules.js (Rules / Customize Rules…).
Our case was a bit complicated, as the amount of the network traffic was really not proportional with the response times. Small response packages was just as slow as huge ones. So I had to use a custom, fix delay in the OnBeforeResponse function.
I have achieved this delay using a custom wait function:
static function wait(msecs)
var start = new Date().getTime();
var cur = start;
while(cur – start < msecs)
cur = new Date().getTime();
Then I can use this call in OnBeforeResponse:
However, using this simple function call would make every response slow, not only the ones received from our test web server. For example, a web search, or checking your web mail on the same system would be slow as well – a quite inconvenient side effect.
The solution to the problem was an extra condition:
where localhost:64399 is the name and the port number of our test web system.