Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bandwidth-test package for maximum available bandwidth towards the internet #557

Merged
merged 4 commits into from Sep 5, 2019

Conversation

@ilario
Copy link
Member

commented Aug 11, 2019

This Lua script downloads a list of files from the internet (it could also be used for measuring the local network speed, but for this case using netperf like in lime-metrics would be more proper).

In order to not take too long on slow networks, the downloads are interrupted after a specific time (the SINGLE_TEST_DURATION option). This has the drawback that on fast connections, the SINGLE_TEST_DURATION time has to be waited even if the file download has already finished.
In my opinion this is not a problem, but if you want I can try to change this.

The final speed output is taken as the median of a few measurements on different servers (by default 5, this is the NONZERO_TESTS option). The measurements that give zero speed are discarded. This happens quite often as Busybox wget cannot manage any kind of redirection.
It can also happen if a too short SINGLE_TEST_DURATION is employed (wget timeout is set to SINGLE_TEST_DURATION*0.75).

The list of files to download has been adapted from @p4u's bmx7-auto-gw-bw-mode package.

The parameters are documented in the package's help:

Usage: bandwidth-test [SINGLE_TEST_DURATION] [NONZERO_TESTS] [SERVERS_LIST]
Measures the maximum available bandwidth downloading a list of files.
The measurement will take approximately SINGLE_TEST_DURATION*NONZERO_TESTS seconds.
The download of each URL is attempted at most one time: multiple URLs should be provided.
The speed in B/s is printed to STDOUT.

SINGLE_TEST_DURATION  fixed duration of each download process,
                      if missing reads from UCI status-report (default 20)
NONZERO_TESTS         minimum number of successful downloads,
                      if missing reads from UCI status-report (default 5)
SERVERS_LIST          a space-separated list of files' URLs to download,
                      preferably large files.
                      When running with Busybox wget, has to include http://
                      and will likely fail with https://
                      if missing reads from UCI status-report
                      (defaults to a list of 10 MB files on various domains)

The arguments are optional but their ordering is fixed (the first argument is SINGLE_TEST_DURATION, the second is NONZERO_TESTS and from the third on they are the SERVERS_LIST).

The parameters can be provided as options from the command line.
If UCI is present in the system (e.g. when using this script in OpenWrt), it is used for accessing the parameters in /etc/config/bandwidth-test.
If no arguments are provided and UCI is missing or the configuration is empty, use the default hardcoded parameters.

@ilario ilario requested review from G10h4ck and gmarcos87 Aug 11, 2019

@ilario

This comment has been minimized.

Copy link
Member Author

commented Aug 14, 2019

An alternative approach would be to use netperf, I just realized that some public servers do exist:

netperf.bufferbloat.net (also called netperf-east.bufferbloat.net)
netperf-west.bufferbloat.net
netperf-eu.bufferbloat.net

An advantage of bandwidth-test over netperf is that it used port 80, which is never filtered by shitty internet providers (e.g. see page 32 of eduroam policy here).

@nicopace
Copy link
Member

left a comment

looks good!

@gmarcos87
Copy link
Member

left a comment

I confirmed it works, installed it and compared the results.
I approved it as it is, something I would like you to have is the option to print a message more usable by other scritps without having to resort to cut and grep.

@ilario

This comment has been minimized.

Copy link
Member Author

commented Sep 5, 2019

print a message more usable by other scritps without having to resort to cut and grep.

@gmarcos87 please note that the scripts parsable output is the only thing going to STDOUT while the human readable output is on STDERR. Is this enough to satisfy your comment?

@gmarcos87

This comment has been minimized.

Copy link
Member

commented Sep 5, 2019

@nicopace nicopace merged commit c76d867 into libremesh:master Sep 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.