Mimic 'slowness' of web server on local computer

寵の児 提交于 2019-12-03 15:26:06

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.

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.

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.

Paolo Bergantino

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.

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.

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

http://www.charlesproxy.com/

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

If you use Fiddler 2, you can install this Add-On: Fiddler - Connection Simulator.

It gives you a nice UI to setup Bandwith and different simulation kinds.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!