tcping icon indicating copy to clipboard operation
tcping copied to clipboard

Seems every ping after the first one has the wrong timing data

Open iopq opened this issue 3 years ago • 2 comments

Ping tcp://example.com:80(93.184.216.34:80) - Connected - time=233.248409ms
Ping tcp://example.com:80(93.184.216.34:80) - Connected - time=419.692µs
Ping tcp://example.com:80(93.184.216.34:80) - Connected - time=530.75µs
Ping tcp://example.com:80(93.184.216.34:80) - Connected - time=550.278µs

Ping statistics tcp://example.com:80
	4 probes sent.
	4 successful, 0 failed.
Approximate trip times:
	Minimum = 419.692µs, Maximum = 233.248409ms, Average = 58.687282ms

It should really be returning 200ish ms

I'm accessing the internet through a proxy, so it might have something to do with it

iopq avatar Dec 27 '21 07:12 iopq

Since the 2nd, 3rd, and 4th round trip times are in microseconds, not milliseconds, they barely contribute to the computation of the average, since the first round trip time is about 500x greater. Therefore, the simple average -- total/n -- is indeed about 58ms. (I think there should be an option to specify all roundtrip times in the same units. It's hard at a glance to notice the differences between the microseconds and the milliseconds.)

Perhaps outliers should be discarded before computing the average is computed, because the web server might be cold initially, throwing off the calculation of the average.

Alternatively, a median could be added to the statistics. Medians by their nature ignore outliers.

sidecut avatar Jul 11 '23 16:07 sidecut

Alternatively, a median could be added to the statistics. Medians by their nature ignore outliers.

the problem is that I don't believe the actual latency is 400µs after the first one

that sounds like the latency to my localhost proxy

iopq avatar Nov 06 '23 15:11 iopq