August 30, 2020

Speedtest vs ISP and at home

Updated 2020-11-30 !

Sometimes you are doubtful about the performance of your home network, or versus the ISP, and wonder, where is the bottleneck ?

After some Googling I found some favorite applications, implemented on a cable connected Raspberry PI(RPi), which do the job so You can start measure and stop guessing.

A speedtest, 
  • checking Your ISP, with just a bash script
  • for Your home network
Graph without database ? Check this with NodeRed

ISP checking


My approach for checking the ISP, Internet Service Provider, is to measure every 20 minutes and collect the data to a file. The file could then be mailed to anyone or just checked now and then.

The solution was this application which very easy could be set up as cronjob. The approach uses Curl to get the latest version and then run it locally.

So logged on, to the RPi in a terminal session, just add a cronjob with 

crontab -e

and add this line att the end

*/20 * * * * echo "$(curl -skLO https://git.io/speedtest.sh && chmod +x speedtest.sh && ./speedtest.sh)" >> speedtest.txt

The command will be executed every 20 minutes, 00;20;40, and the result from the job will be appended to the file speedtest.txt. The file content will look something like

2018-11-12, 14:20, 39.391, 9.14, 1.14
2018-11-12, 14:40, 32.615, 10.06, 1.10
2018-11-12, 15:00, 36.792, 8.95, 1.15
2018-11-12, 15:20, 35.289, 10.04, 1.12
2018-11-12, 15:40, 32.387, 9.62, 1.12
2018-11-12, 16:00, 35.62, 10.13, 1.10
2018-11-12, 16:20, 31.576, 9.78, 1.10
2018-11-12, 16:40, 39.69, 10.14, 1.10
2018-11-12, 17:00, 38.674, 9.01, 1.16
2018-11-12, 17:20, 36.445, 10.11, 1.07
2018-11-12, 17:40, 35.851, 10.12, 1.11
2018-11-12, 18:00, 41.61, 10.10, 1.12
2018-11-12, 18:20, 35.614, 9.87, 1.06
2018-11-12, 18:40, 34.901, 10.02, 1.09

with date, local time, ping in milliseconds, followed by download and upload speeds in Mbps (Megabits per second).

If You want to mail it somewhere this guide is nice.

Home client checking

My approach here is an application made for a self-hosted speedtest. Se picture in the beginning of this post.

It needs a Apache server with PHP and You can find a setup here.

Create a new directory, logged on as pi, in the default Apache document root with 

sudo mkdir /var/www/html/speedtest

You will find the source for Librespeed at Github, and download it with 

wget https://github.com/librespeed/speedtest/archive/master.zip


and unzip with 

unzip master.zip

Go to the downloaded directory

cd speedtest-master

Copy the files You need for the application to the Apache folder

sudo cp -r speedtest.js speedtest_worker.js example-singleServer-pretty.html backend /var/www/html/speedtest

Rename the example file

sudo mv /var/www/html/speedtest/example-singleServer-pretty.html /var/www/html/speedtest/index.html

Default owner of the Apache folder is www-data, so change the new files accordingly

sudo chown -R www-data:www-data /var/www/html/speedtest/

Open the application in Your WEB-browser at URL

http://your_host/speedtest/

and check the application from different devices, it is quite a difference !

Clean up with rm -rf master.zip speedtest-master

No comments:

Post a Comment

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !