views:

218

answers:

7

Hi,

Is it possible to somehow mimic the slower download speeds of my website, as if it is hosted on a web server, but from my localhost?

It's hard to test things like Ajax loading icons when the content loads so quick from your local machine so I think this could help me out a lot?

I was wondering if there was a tool that you could use for this or if you'd need to use javascript to add setTimeout or setInterval code?

A: 

This question may help you out.

Personally, I add something like this at the top of my library file or whatever file always gets included:

if(DEBUG) {
    sleep(2);
}

The above is PHP, but most languages are going to have something similar.

Paolo Bergantino
+1  A: 

If you're on a *nix platform, you could alter the 'nice' level to basically make your process an afterthought behind most others until you achieve a level of 'lag' that is satisfactory to your needs.

byte
A: 

One option is (if You are on linux, but other unix system have similar tools) Traffic shaping (google for 'HTB', 'qdics' and 'tc' command)

Second option will be apache_mod_cband module, this is also probably easer to get going.

greg
+4  A: 

If you are using Windows, then download the Fiddler tool Fiddler.

This will setup a HTTP proxy that you can use for testing HTTP headers and view all the HTTP traffic within the PC and browser. You can then use the Rules > Performance > Simulate Modem Speeds option to slow the browser's HTTP connection.

There is also a Fiddler Switch plug-in for Firefox available to toggle the Fiddler proxy.

Luke
Current versions of Fiddler install a Firefox addon already; no need to install a separate plugin.
EricLaw -MSFT-
Ah okay, nice - thanks for letting me know!
Luke
The "Simulate Modem Speeds" in Fiddler seems to just introduced a delay between response and the next request. Is there a tool or fiddler plugin that will actually limit bandwidth (using Windows 7)?
JoshNaro
A: 

You could try Charles. It's cross platform - I use it and it works really well.

http://www.charlesproxy.com/

andrewdotcom
A: 

On windows you can use Proxomitron or you can install fiddler (for ie). Both let you set the download speed.

jonot
+1  A: 

First of all, please never mangle your code with if ( DEBUG ) workSlowly(); statements. You will get bitten by this practice, and it will hurt.

Second of all, use one of the traffic throttling solutions which have already been posted here. I'm going to add a Java-based solution: Sloppy. It's dead easy to set up and runs everywhere where Java runs.

Robert Munteanu
Thanks for the downvote. Appreciate the explanatory comment.
Robert Munteanu
Was the second one your evil twin brother?
Robert Munteanu