@greensea
2017-03-17T07:39:58.000000Z
字数 5456
阅读 1729
在将云主机的流量占满之后,Ping 延迟会逐步加大,甚至达到上千毫秒的程度。
下面是一个测试,在 ping 云主机的同时,使用 SCP 从主机上复制一份文件到本地。主机的上行带宽是 2Mbps,在复制文件的时候,可以将上行带宽跑满。
PING swift (106.75.29.248) 56(84) bytes of data.
64 bytes from swift (106.75.29.248): icmp_seq=1 ttl=51 time=40.4 ms
64 bytes from swift (106.75.29.248): icmp_seq=2 ttl=51 time=39.7 ms
64 bytes from swift (106.75.29.248): icmp_seq=3 ttl=51 time=41.5 ms
64 bytes from swift (106.75.29.248): icmp_seq=4 ttl=51 time=40.2 ms
64 bytes from swift (106.75.29.248): icmp_seq=5 ttl=51 time=39.1 ms
64 bytes from swift (106.75.29.248): icmp_seq=6 ttl=51 time=39.8 ms
64 bytes from swift (106.75.29.248): icmp_seq=7 ttl=51 time=39.6 ms
64 bytes from swift (106.75.29.248): icmp_seq=8 ttl=51 time=41.0 ms
64 bytes from swift (106.75.29.248): icmp_seq=9 ttl=51 time=40.0 ms
64 bytes from swift (106.75.29.248): icmp_seq=10 ttl=51 time=39.8 ms
64 bytes from swift (106.75.29.248): icmp_seq=11 ttl=51 time=39.6 ms
64 bytes from swift (106.75.29.248): icmp_seq=12 ttl=51 time=39.3 ms
64 bytes from swift (106.75.29.248): icmp_seq=13 ttl=51 time=39.9 ms
64 bytes from swift (106.75.29.248): icmp_seq=14 ttl=51 time=41.7 ms
64 bytes from swift (106.75.29.248): icmp_seq=15 ttl=51 time=40.9 ms
64 bytes from swift (106.75.29.248): icmp_seq=16 ttl=51 time=40.1 ms
64 bytes from swift (106.75.29.248): icmp_seq=17 ttl=51 time=39.4 ms
64 bytes from swift (106.75.29.248): icmp_seq=18 ttl=51 time=40.3 ms
64 bytes from swift (106.75.29.248): icmp_seq=19 ttl=51 time=39.7 ms
64 bytes from swift (106.75.29.248): icmp_seq=20 ttl=51 time=40.4 ms
64 bytes from swift (106.75.29.248): icmp_seq=21 ttl=51 time=300 ms
64 bytes from swift (106.75.29.248): icmp_seq=22 ttl=51 time=398 ms
64 bytes from swift (106.75.29.248): icmp_seq=23 ttl=51 time=449 ms
64 bytes from swift (106.75.29.248): icmp_seq=24 ttl=51 time=487 ms
64 bytes from swift (106.75.29.248): icmp_seq=25 ttl=51 time=525 ms
64 bytes from swift (106.75.29.248): icmp_seq=26 ttl=51 time=574 ms
64 bytes from swift (106.75.29.248): icmp_seq=27 ttl=51 time=717 ms
64 bytes from swift (106.75.29.248): icmp_seq=28 ttl=51 time=909 ms
64 bytes from swift (106.75.29.248): icmp_seq=29 ttl=51 time=1159 ms
64 bytes from swift (106.75.29.248): icmp_seq=30 ttl=51 time=1414 ms
64 bytes from swift (106.75.29.248): icmp_seq=31 ttl=51 time=1652 ms
64 bytes from swift (106.75.29.248): icmp_seq=32 ttl=51 time=1912 ms
64 bytes from swift (106.75.29.248): icmp_seq=33 ttl=51 time=2173 ms
64 bytes from swift (106.75.29.248): icmp_seq=34 ttl=51 time=2410 ms
64 bytes from swift (106.75.29.248): icmp_seq=35 ttl=51 time=2672 ms
64 bytes from swift (106.75.29.248): icmp_seq=36 ttl=51 time=2919 ms
64 bytes from swift (106.75.29.248): icmp_seq=37 ttl=51 time=3167 ms
64 bytes from swift (106.75.29.248): icmp_seq=38 ttl=51 time=3427 ms
64 bytes from swift (106.75.29.248): icmp_seq=39 ttl=51 time=3676 ms
64 bytes from swift (106.75.29.248): icmp_seq=40 ttl=51 time=3941 ms
64 bytes from swift (106.75.29.248): icmp_seq=41 ttl=51 time=4188 ms
64 bytes from swift (106.75.29.248): icmp_seq=42 ttl=51 time=4436 ms
64 bytes from swift (106.75.29.248): icmp_seq=43 ttl=51 time=4690 ms
64 bytes from swift (106.75.29.248): icmp_seq=44 ttl=51 time=4940 ms
64 bytes from swift (106.75.29.248): icmp_seq=45 ttl=51 time=5193 ms
64 bytes from swift (106.75.29.248): icmp_seq=46 ttl=51 time=5453 ms
64 bytes from swift (106.75.29.248): icmp_seq=47 ttl=51 time=5696 ms
64 bytes from swift (106.75.29.248): icmp_seq=48 ttl=51 time=5907 ms
64 bytes from swift (106.75.29.248): icmp_seq=49 ttl=51 time=5897 ms
64 bytes from swift (106.75.29.248): icmp_seq=50 ttl=51 time=5902 ms
64 bytes from swift (106.75.29.248): icmp_seq=51 ttl=51 time=5910 ms
64 bytes from swift (106.75.29.248): icmp_seq=52 ttl=51 time=5911 ms
64 bytes from swift (106.75.29.248): icmp_seq=53 ttl=51 time=5905 ms
64 bytes from swift (106.75.29.248): icmp_seq=54 ttl=51 time=5979 ms
64 bytes from swift (106.75.29.248): icmp_seq=55 ttl=51 time=6239 ms
64 bytes from swift (106.75.29.248): icmp_seq=56 ttl=51 time=6478 ms
64 bytes from swift (106.75.29.248): icmp_seq=57 ttl=51 time=6739 ms
64 bytes from swift (106.75.29.248): icmp_seq=58 ttl=51 time=6912 ms
64 bytes from swift (106.75.29.248): icmp_seq=59 ttl=51 time=5912 ms
64 bytes from swift (106.75.29.248): icmp_seq=60 ttl=51 time=4914 ms
64 bytes from swift (106.75.29.248): icmp_seq=61 ttl=51 time=3879 ms
64 bytes from swift (106.75.29.248): icmp_seq=62 ttl=51 time=2884 ms
64 bytes from swift (106.75.29.248): icmp_seq=63 ttl=51 time=1884 ms
64 bytes from swift (106.75.29.248): icmp_seq=64 ttl=51 time=892 ms
64 bytes from swift (106.75.29.248): icmp_seq=65 ttl=51 time=39.5 ms
64 bytes from swift (106.75.29.248): icmp_seq=66 ttl=51 time=40.7 ms
64 bytes from swift (106.75.29.248): icmp_seq=67 ttl=51 time=39.5 ms
64 bytes from swift (106.75.29.248): icmp_seq=68 ttl=51 time=40.6 ms
64 bytes from swift (106.75.29.248): icmp_seq=69 ttl=51 time=40.7 ms
64 bytes from swift (106.75.29.248): icmp_seq=70 ttl=51 time=40.6 ms
64 bytes from swift (106.75.29.248): icmp_seq=71 ttl=51 time=41.0 ms
64 bytes from swift (106.75.29.248): icmp_seq=72 ttl=51 time=41.4 ms
64 bytes from swift (106.75.29.248): icmp_seq=73 ttl=51 time=39.3 ms
64 bytes from swift (106.75.29.248): icmp_seq=74 ttl=51 time=40.6 ms
64 bytes from swift (106.75.29.248): icmp_seq=75 ttl=51 time=40.6 ms
64 bytes from swift (106.75.29.248): icmp_seq=76 ttl=51 time=40.5 ms
64 bytes from swift (106.75.29.248): icmp_seq=77 ttl=51 time=39.3 ms
^C
--- swift ping statistics ---
77 packets transmitted, 77 received, 0% packet loss, time 76221ms
rtt min/avg/max/mdev = 39.138/2064.568/6912.038/2390.483 ms, pipe 7
在 Ping 第 20 个包的时候,开始使用 SCP 复制文件,大约在第 60 个 ping 包的时候,复制完成。
可以看到,在还没有开始下载文件的时候, ping 延迟正常,当开始下载文件后,ping 延迟开始不断变大,最大时延迟甚至超过 6 秒。当下载完成之后,ping 延迟迅速恢复到正常水平。
这种情况和 TCP over TCP 问题非常相似,我猜测可能是你们在自己的虚拟局域网中使用了一种可靠的协议来进行数据传输,于是造成了类似 TCP over TCP 的问题。
路由器缓存设置过大也有可能造成此问题,但这种情况一般比较少见,我更倾向于是你们在自己虚拟局域网中使用了可靠的协议来做数据传输。
更罕见的情况是,你们使用的流控机制存在问题,在包速率超出限制时,没有丢包,而是把包排入队列中等待发送,这也会造成类似的情况。
另外,我需要特别指出的是,我们的上行带宽过小(2Mbps)并不是造成此种现象的原因。正常情况下,如果吞吐量达到带宽极限,出现的现象应该是 ping 丢包。从上面的 ping 结果来看,ping 包并没有被丢弃,而是在经过了一个很长的时间后才收到,这并不是正常的表现。我希望,在上行带宽在跑满的时候,IP 层上的包会被丢弃,让 TCP 来进行带宽调配,保证我的用户能够较为正常地使用网络。
希望你们能够调查这个问题,并尽早给出反馈。