OpenWrt Forum Archive

Topic: How To run SpeedTest command line evaluation ?

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I just discovered this tool that allow to evaluate our internet connection with a command line (SpeedTest).
Does somebody tell us how could we install this on our router (no known package) to get it working ?
https://github.com/sivel/speedtest-cli

Sincerely thanks and have a nice day,

Miguipda ;-)

It's unlikely anyone will get this running. I suspect a Python interpreter would be too large for most OpenWRT devices.

Instead, here's a script I knocked together for the purpose..

#!/bin/sh

# enter a size, 3, 10 (50 or 100 would also work, if you have the space)
TESTSIZE=10

TESTFILE=$TESTSIZE"mb.bin"
START=$(date +%s)
runtime=$(time wget -P /tmp/ ftp://ftp.xs4all.nl/pub/test/$TESTFILE)
SIZE=$(ls -la /tmp/$TESTFILE | awk '{ print $5}')
rm /tmp/$TESTFILE
END=$(date +%s)
DIFF=$(( $END - $START ))
AVE=$(( ( $SIZE / $DIFF) / 1024 ))

echo "Downloaded $TESTSIZE MB in $DIFF seconds "
echo -n "Average Speed: "
echo "$AVE Mbps"

exit 0

;o) Cor

Thanks for the script, It worked great or me!

Here's another alternative for testing from the command line, since speedtest.net doesn't actually do a complete test. (It only sends a few pings before starting the download/upload test, but ignores what happens to latency during the transfers.) If the latency gets high during the test, the router has bufferbloat. (Is your router bloated? See note below)

Two good tests:

* DSLReports Speed Test a nice web-based (no annoying plugins!) speed test http://dslreports.com/speedtest

* For the command-line: The Bufferbloat project (at http://www.bufferbloat.net/projects/cerowrt/wiki ) created a script - betterspeedtest.sh that tests download and upload speeds (like all the others) but also measures latency *during* the test.

To run the test on Barrier Breaker or Chaos Calmer, you need to install the netperf package. Do this one time:
  - Go to System -> Software, click Update Lists
  - Click the Available Packages tab, and find "netperf" in the "N" section, then click Install

Next retrieve the betterspeedtest.sh script from Github at https://github.com/richb-hanover/OpenWrtScripts Either copy/paste the script, or use the steps in the README to pull them down using git.

Finally, run the script with

sh betterspeedtest.sh

Note for Bufferbloat on OpenWrt: Fortunately, OpenWrt has the SQM/fq_codel scripts that basically eliminate Bufferbloat. See this page for instructions: http://wiki.openwrt.org/doc/howto/sqm )

You could also just use iperf imo. But you'll need a reliable server to test against for that.

betterspeedtest.sh stop reporting download and upload speeds. Shows 0 Mbps

Wondering if anyone had any input how to fix the issue.

2016-06-01 02:09:42 Testing against netperf.bufferbloat.net (ipv4) with 5 simultaneous sessions while pinging gstatic.com (60 seconds in each direction)
........................
 Download:  0 Mbps
  Latency: (in msec, 24 pings, 0.00% packet loss)
      Min: 29.099
    10pct: 30.124
   Median: 37.631
      Avg: 35.850
    90pct: 40.354
      Max: 42.275
........................
   Upload:  0 Mbps
  Latency: (in msec, 24 pings, 0.00% packet loss)
      Min: 30.710
    10pct: 30.750
   Median: 38.712
      Avg: 37.504
    90pct: 40.448
      Max: 41.169
root@OpenWrt:/tmp#

default host netperf.bufferbloat.net is KO
use instead:

sh betterspeedtest.sh -H netperf-eu.bufferbloat.net  #for EU
sh betterspeedtest.sh -H netperf-east.bufferbloat.net  #for (east coast US) - seems KO also
sh betterspeedtest.sh -H netperf-west.bufferbloat.net  #for (California)

(Last edited by maurer on 1 Jun 2016, 07:39)

The default server seems to be back in business, and the ones the maurer listed above weren't working --

so it all looks good without having to specify a host

(and yes, I'm proud of my download speeds -- yay to those corporate barons at comcast)

# sh betterspeedtest.sh -t 30
2016-06-29 12:05:50 Testing against netperf.bufferbloat.net (ipv4) with 5 simultaneous sessions while pinging gstatic.com (30 seconds in each direction)
...............................
Download:  218.24 Mbps
  Latency: (in msec, 31 pings, 0.00% packet loss)
      Min: 5.414
    10pct: 10.325
   Median: 281.719
      Avg: 211.276
    90pct: 288.038
      Max: 293.896
...............................
   Upload:  11.88 Mbps
  Latency: (in msec, 31 pings, 0.00% packet loss)
      Min: 27.376
    10pct: 46.599
   Median: 63.950
      Avg: 60.473
    90pct: 69.599
      Max: 70.903

cititechs wrote:

betterspeedtest.sh stop reporting download and upload speeds. Shows 0 Mbps

Wondering if anyone had any input how to fix the issue.

2016-06-01 02:09:42 Testing against netperf.bufferbloat.net (ipv4) with 5 simultaneous sessions while pinging gstatic.com (60 seconds in each direction)
........................
 Download:  0 Mbps
  Latency: (in msec, 24 pings, 0.00% packet loss)
      Min: 29.099
    10pct: 30.124
   Median: 37.631
      Avg: 35.850
    90pct: 40.354
      Max: 42.275
........................
   Upload:  0 Mbps
  Latency: (in msec, 24 pings, 0.00% packet loss)
      Min: 30.710
    10pct: 30.750
   Median: 38.712
      Avg: 37.504
    90pct: 40.448
      Max: 41.169
root@OpenWrt:/tmp#

Old post I know but the answer is that the site/service seems to go down and isn't always up. I test against it which is why I know this.

Update, early July 2016: All the bufferbloat netperf servers are back on the air.

maurer wrote:

default host netperf.bufferbloat.net is KO
use instead:

sh betterspeedtest.sh -H netperf-eu.bufferbloat.net    #for EU
sh betterspeedtest.sh -H netperf-east.bufferbloat.net  #for (east coast US) - seems KO also
sh betterspeedtest.sh -H netperf-west.bufferbloat.net  #for (California)

netperf-west had a hardware failure at a remote site while the admin was abroad.

netperf.bufferbloat.net (the default server, also netperf-east.bufferbloat.net) was reaching its bandwidth limit by the 25th of the month, at which point the hosting provider would shut off the server until the new month.

To address this, we examined use patterns that showed that two-thirds of the total number of test runs were coming from just 15 remote IP addresses. A few tweaks to iptables to drop those addresses caused bandwidth consumption to plummet, and now use is increasing by about 1% of the monthly limit per day. netperf.bufferbloat.net is now consuming about 50 GBytes/day.

TL;DR Please feel free to use these servers for occasional tests. If you are a researcher who needs more testing, send a note to the address on the About page of http://netperf.bufferbloat.net/ Sustained overuse of the servers may lead to blockage.

(Last edited by richbhanover on 8 Jul 2016, 19:15)

Don't all speed test sites know and plan for a very large amount of bandwidth? What's the point of putting out such a test if the provider doesn't know that's what will happen.

projects wrote:

Don't all speed test sites know and plan for a very large amount of bandwidth? What's the point of putting out such a test if the provider doesn't know that's what will happen.

Sure - I knew that when I built the server for the bufferbloat research community. When the traffic didn't seem very high, we gradually publicized the servers to the world.

A few dozen sites were consuming the lion's share of the bandwidth. Those IP addresses weren't individuals making occasional tests, or network performance researchers who use it heavily for a while and the stop. Instead, the addresses seemed to be running automated tests every 5-10 minutes, 24x7.

You won't see any advertising, even when you get to http://netperf.bufferbloat.net. So I'm paying for the server myself. I am happy to allow researchers or individuals to use the server. But I decided to block those extremely heavy users whose use was a measurable fraction of my limit. If they need to collect data that frequently, they can set up their own server. I'm even willing to help them set it up. Contact me through the About page...

For me personally, I better understand now. I read some other things about bufferbloat where Google was somehow involved and interested so thought they were part of this offering. I didn't realize an individual was offering their server.

I can see why you would need to control access but keep in mind that sometimes, while developing scripts and tools, a person might end up looking like a heavy user and would eventually trim it back once they have their code working well.

I say this because someone I know was using your site while working on something smile.

My current detection algorithm flags high traffic when a single address exceeds 20,000 sessions per week, or makes over 500 sessions per hour over many days. At 8 sessions/speedtest, that works out to about 2,500 speedtests per week, or 60 speedtests per hour.

Below that threshold, I won't notice the traffic. And if you know someone doing research/development, please send them my way - I love to get fan mail. Thanks.

(Last edited by richbhanover on 10 Jul 2016, 15:14)

Definitely wasn't my friend then. He only tested a few times per hour not wanting to put any load on anyone.
I'll PM you as I have some questions.

projects wrote:

I'll PM you as I have some questions.

I'm not sure how the PM works in this forum, but send an email using the address on the site above. Thanks.

richbhanover wrote:
projects wrote:

I'll PM you as I have some questions.

I'm not sure how the PM works in this forum, but send an email using the address on the site above. Thanks.

Will do. I'll be in touch in the near future.

Cor wrote:

It's unlikely anyone will get this running. I suspect a Python interpreter would be too large for most OpenWRT devices.

Instead, here's a script I knocked together for the purpose..

#!/bin/sh

# enter a size, 3, 10 (50 or 100 would also work, if you have the space)
TESTSIZE=10

TESTFILE=$TESTSIZE"mb.bin"
START=$(date +%s)
runtime=$(time wget -P /tmp/ ftp://ftp.xs4all.nl/pub/test/$TESTFILE)
SIZE=$(ls -la /tmp/$TESTFILE | awk '{ print $5}')
rm /tmp/$TESTFILE
END=$(date +%s)
DIFF=$(( $END - $START ))
AVE=$(( ( $SIZE / $DIFF) / 1024 ))

echo "Downloaded $TESTSIZE MB in $DIFF seconds "
echo -n "Average Speed: "
echo "$AVE Mbps"

exit 0

This worked well on my Almond+.

The discussion might have continued from here.