go-ping / ping

ICMP Ping library for Go
MIT License
1.33k stars 345 forks source link

Measured times are greater then regular ping #179

Closed manio closed 1 year ago

manio commented 3 years ago

Hi, I am testing go-ping and comparing it to a regular ping utility (Debian Linux x86_64). I am pinging a host in LAN to have a stable testing environment. Here are the results from a ping:

285 packets transmitted, 285 received, 0% packet loss, time 286287ms
rtt min/avg/max/mdev = 0.507/0.665/0.980/0.062 ms

The problem I can see is that using a go-ping gives averages to be about 100ms higher (calling it multiple times with sending single request as in the code) and it's not uncommon to have values above 1ms which doesn't happen at all with a ping tool. I am testing it using this code.

Here is the comparison of the resulted ping times from telegraf: image First part of the graph is a go-ping results, then I switched to a regular ping utility.

Is it a go-runtime overhead? Can we get rid of it and make the results in-pair with a regular ping tool?

CHTJonas commented 3 years ago

Go is a GC-ed language so massive latency spikes like that might just be par for the course. Alternatively it might be related to #139.