librespeed / speedtest

Self-hosted Speed Test for HTML5 and more. Easy setup, examples, configurable, mobile friendly. Supports PHP, Node, Multiple servers, and more
https://librespeed.org
GNU Lesser General Public License v3.0
12.11k stars 2.19k forks source link

Calculate ping amplitude #321

Open mikhailnov opened 4 years ago

mikhailnov commented 4 years ago

LibreTest looks very useful, thakns a lot, but there is a feature that is not imlemented but would be very useful. I am looking for a tool to self host it on a webinar server (with BigBlueButton). I often need information about maximium ping amplitude. If I understood correctly, jitter is ((previous ping)-(last ping))/(number of measures), but it does not anwer an important question:

Average jitter may be low, e.g. ping may be around 100 ms most of the time, but it may be 800 ms from time to time. If 800 ms happens rarely, an average jitter like it is now will not show that this problem exists. It may be so in case of an unstable mobile broadband connection, for example.

So, my feature request is: print minimal ping, maximal ping and ideally draw a plot of pings time.

adolfintel commented 4 years ago

That is a legitimate question.

To be honest, I'm not too happy with the current algorithm for ping and jitter estimation and I plan to change it in the future.

The value that you get in the ping test is the minimum ping, the jitter is a bit more complicated, but essentially it's the variance between consecutive pings calculated as a sort of weighed average: https://github.com/librespeed/speedtest/blob/6fbe21f2f74f76def581c3354325048a2abe4e8e/speedtest_worker.js#L633

This behavior was introduced in the September 2019 update, and since then I've noticed that it tends to somewhat overestimate jitter, so a better algorithm is needed. Before that, it was a simple average for both, which was undershooting it considerably in my opinion.

Feel free to propose a solution if you want. I can't give you an ETA of course, LibreSpeed is not my job.

kakarata commented 4 years ago

Hi guys, I read how ping/jitter is calculated here. A line graph would be the best and could be updated each 200ms as dl/ul speed. If difference is less or more ms, then graph the diff.

SCG82 commented 4 years ago

RFC 3550 estimates interarrival jitter (defined as an estimate of the the mean deviation of the difference in packet spacing at the receiver compared to the sender for a pair of packets, which is equivalent to the difference in the 'relative transit time' for the two packets):

jitter = jitter * 0.9375 + instjitter * 0.0625

"This algorithm is the optimal first-order estimator and the gain parameter 1/16 (0.0625) gives a good noise reduction ratio while maintaining a reasonable rate of convergence." (https://tools.ietf.org/html/rfc3550#section-6.4.1)