Mat*_*att 5 networking linux wireless-networking ping
我一直在经历一些奇怪的行为。在拥塞的无线网络上运行时
$ ping google.com
Run Code Online (Sandbox Code Playgroud)
我希望每秒发送一个数据包,并且只有其中一些数据包以各种往返时间返回,这是大多数情况下的行为。但是在这个非常拥挤的无线网络上,我看到的是这样的:
PING google.com (74.125.224.228) 56(84) bytes of data.
64 bytes from lax04s08-in-f4.1e100.net (74.125.224.228): icmp_req=1 ttl=53 time=193 ms
64 bytes from lax04s08-in-f4.1e100.net (74.125.224.228): icmp_req=2 ttl=53 time=238 ms
64 bytes from lax04s08-in-f4.1e100.net (74.125.224.228): icmp_req=3 ttl=53 time=96.8 ms
64 bytes from lax04s08-in-f4.1e100.net (74.125.224.228): icmp_req=4 ttl=53 time=12.9 ms
64 bytes from lax04s08-in-f4.1e100.net (74.125.224.228): icmp_req=5 ttl=53 time=219 ms
64 bytes from lax04s08-in-f4.1e100.net (74.125.224.228): icmp_req=9 ttl=53 time=1105 ms
64 bytes from lax04s08-in-f4.1e100.net (74.125.224.228): icmp_req=8 ttl=53 time=2339 ms
64 bytes from lax04s08-in-f4.1e100.net (74.125.224.228): icmp_req=17 ttl=53 time=881 ms
64 bytes from lax04s08-in-f4.1e100.net (74.125.224.228): icmp_req=18 ttl=53 time=1200 ms
...
--- google.com ping statistics ---
57 packets transmitted, 41 received, 28% packet loss, time 113307ms
rtt min/avg/max/mdev = 5.773/447.217/2339.271/496.011 ms, pipe 3
Run Code Online (Sandbox Code Playgroud)
关键线是:
57 packets transmitted, 41 received, 28% packet loss, time 113307ms
Run Code Online (Sandbox Code Playgroud)
如您所见,ping 运行了大约 113 秒,但仅发送了 57 个数据包。我已经多次看到这个:
$ ping google.com
PING google.com (74.125.224.232) 56(84) bytes of data.
64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=1 ttl=53 time=6.98 ms
64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=2 ttl=53 time=5.71 ms
64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=3 ttl=53 time=4.47 ms
64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=4 ttl=53 time=5.75 ms
64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=5 ttl=53 time=6.94 ms
64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=6 ttl=53 time=14.2 ms
64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=7 ttl=53 time=6.22 ms
64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=8 ttl=53 time=11.8 ms
64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=9 ttl=53 time=4.29 ms
64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=10 ttl=53 time=5.43 ms
64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=11 ttl=53 time=5.02 ms
64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=12 ttl=53 time=4.89 ms
^C64 bytes from lax04s08-in-f8.1e100.net (74.125.224.232): icmp_req=13 ttl=53 time=7.36 ms
--- google.com ping statistics ---
13 packets transmitted, 13 received, 0% packet loss, time 60262ms
rtt min/avg/max/mdev = 4.299/6.865/14.258/2.838 ms
Run Code Online (Sandbox Code Playgroud)
这个更奇怪,因为所有的 RTT 都是合理的,只是没有快速发送数据包。任何人都可以阐明这一点吗?我正在进行 debian 测试(喘息),还有一些统计数据:
$ ping -V
ping utility, iputils-sss20101006
Linux 3.0.0-1-amd64 #1 SMP Sat Aug 27 16:21:11 UTC 2011 x86_64 GNU/Linux
03:00.0 Network controller: Intel Corporation Centrino Ultimate-N 6300 (rev 35)
Run Code Online (Sandbox Code Playgroud)
看起来您有一个版本,它对ping每个收到的数据包进行 DNS 查找。由于 DNS UDP 数据包必须与 ping 数据包穿越相同的拥塞网络,因此该数据包可能会被丢弃。由于超时和重试,DNS 请求返回数据可能需要很长时间。等待 DNS 响应所花费的时间会延迟下一个 ping 数据包的发送,因为您ping是单线程的并且不使用异步计时器来驱动每个 ping。
如果我的诊断是正确的,添加-n到ping应该可以消除延迟。
| 归档时间: |
|
| 查看次数: |
2656 次 |
| 最近记录: |