Ping with long delay but short reported time
What happens if you use the -n
flag to inhibit the lookup of "symbolic names for host addresses"? The sort of behavior you're describing often suggests delays due to slow reverse DNS lookups.
For the example you've given (cdn.sstatic.net), I see that there is no valid reverse entry that corresponds to the forward entry (I'm seeing 69.174.57.102). This is exactly the sort of situation that can lead to weird behavior if you're using tools that attempts reverse lookups.
Yes this is probably DNS.
2 ways to determine. strace -r ping ... Shows this:
0.000014 fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
0.000015 poll([{fd=4, events=POLLOUT}], 1, 0) = 1 ([{fd=4, revents=POLLOUT}])
0.000020 sendto(4, "\305\351\1\0\0\1\0\0\0\0\0\0\10intel-01\20scinterane"..., 47, MSG_NOSIGNAL, NULL, 0) = 47
0.000022 poll([{fd=4, events=POLLIN}], 1, 5000) = 0 (Timeout)
4.999871 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 5
The 4.999 second delay in the DNS lookup.
Or you can just ping a hostname and ping the IP address directly. Whenever pinging the host name is consistently and substantially slower than pinging the IP address. It is due to delays in the DNS lookup.