Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to use Linux CURL command in my shell script where I make a conversion from Bps to Mbps to get the internet speed.

However, the speed is not accurate. For example, my 100MB internet connection shows initially ~83Mbps. If I run the script again the speed increments. The number keeps climbing if I run the script repeatedly in a ~20 second window. It eventually reports higher than my internet speed. Conversely, if I run this on a verified slow connection the results are higher than the actual speed (verified by speedtest.net)

Questions:

Is the speed being cached somehow?
Are my curl parameters correct?

What I have tried:

Rather than provide the entire script, I give the short snippet showing the raw Bps:

url='https://drive.google.com/file/d/0BxSdRDxsitKielVpTU1UMUhqaE0/view'
curl -qfsS -w '%{speed_download}' -o /dev/null --url "$url"

104778.000 < 1st run
129730.000 < 2nd run
148611.000 < 3rd run
165399.000 < 4th run
132163.000 < 5th run
Posted
Updated 9-Aug-21 20:25pm
Comments
Richard MacCutchan 10-Aug-21 3:22am    
Speed tests are by their nature inaccurate as the actual data rate at any point in time can vary. The rated speed is usually the maximum that your ISP claims can be achieved.
wifinut 12-Aug-21 20:39pm    
Thank you. It's disappointing that it doesn't seem like I can use CURL as a method for accurate speed tests. However, website based speed tests are generally more accurate. Speedtest.net is an example. I agree it's not perfect but it's a lot closer than CURL results.

1 solution

I tried to increase the no. of records per run and computed for records/sec == throughput, ofcourse given the time_total. And expect curl to increase throughput per run, which explains the increase per run, in this case. When i plot Bytes download/sec and Records/sec i see the similar plot. Therefore, it makes more sense to look at the increase as throughput rather than increase in the speed of the download link.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900