联通缓存服务器测速脚本(php)

2016-06-04 00:02:48 +08:00
 weakiwi
<?php
    error_reporting(0);
    for($idx=1;$idx<255;$idx++){
        $url = "http://120.52.72." . (string)$idx . "/www.hi-pda.com/forum/templates/colors/images/logo.gif";
        $stime=microtime(true);
        $result_code = file_get_contents($url);
        $etime=microtime(true);
        if($result_code != false){
            $distance = $etime - $stime;
            echo "120.52.72.$idx ". "time: $distance\n";
        }
    }
?>

过段时间把返回改成 json 的,请求改成并发的

2063 次点击
所在节点    问与答
1 条回复
fcicq
2016-06-04 00:12:26 +08:00
那套是负载均衡的. 偶尔可能有不均衡的情况, 以运营商的 scale 你一个人用写死一个 IP 也没事.

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/283381

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX