User Tools

Site Tools


projects:speedtest

This is an old revision of the document!


Projects: Speedtest

I'm testing out some new 5G antennas and after experimenting with a number of different ways to measure their performance I decided the most reliable and simplest way was to simple some real-life activity i.e. write a script that repeats a download and then plot the results in a graph. That allows me to average out any interference, network effects etc.

First, create some test files and put them on somewhere with reliable hosting (AWS for example):

dd if=/dev/zero of=/var/www/10mb-test-file bs=1024 count=10240
dd if=/dev/zero of=/var/www/50mb-test-file bs=1024 count=51200

Then write some code that times the download and saves the result to a CSV.

speedtest.php
<?php
while(true) {
        $time_start = microtime(true);
        $url = "https://putitonyourowndomain.com/testfile10";
        $data = file_get_contents($url);
        $time_end = microtime(true);
        $download_time = $time_end - $time_start;
        echo date("Y-m-d H:i:s")."\t";
        echo $download_time."\t";
        echo (10/$download_time)."\n";
        sleep(60);
}
?>

Run it (in a screen or in the background) with:

php speedtest.php > results.log

Which gives results like this (datetime, seconds to download, average mb/s):



projects/speedtest.1659467748.txt.gz · Last modified: 2022/08/02 20:15 by admin