源:http://my.oschina.net/qinlinwang/blog/55136
评:
设计网站或网络应用程序时,人们常常想知道在低速网络下程序的表现。比如有些网页设计者会关心网站在5Kb/s的速度下载入情况是怎样的等等。
方法
Linux中实现此过程非常简单,只需使用一款叫做iprelay(旧称ip_relay)的工具[1]。该工具实际上是一个Perl脚本,可以把本地或远程的某个端口映射到本地的另一个端口,并限制流速。
程序的参数也很简单,如在Archlinux中:
/usr/bin/ip_relay.pl [ [-d] [-b n] local_port:remote_host:remote_port]
local_port:remote_host:remote_port
即将remote_host:remote_port映射到localhost:local_port
-b n
即限制最大速度为n字节每秒
-d
让iprelay在后台执行。
示例
/usr/bin/ip_relay.pl -b 50000 8081:localhost:80
上例将 localhost:80 映射到 localhost:8081,如果有本地Web服务器在运行,用浏览器访问 http://localhost:8081 即可感受5kb/s慢速网络的效果。
模拟低速网络
猜你喜欢
转载自mauersu.iteye.com/blog/2100828
今日推荐
周排行