You are not logged in.

#1 2021-11-14 21:20:35

Tyskr
Member
Registered: 2019-12-11
Posts: 67

How does Arch Linux measure download speed?

Hi guys,

so I have this i3 polybar module which is supposed to show me my download speed.
If I do test it with external speedtests, it always shows above 500 MB/s.

But in the module, it is never going above 3 MB/s, which is quite odd.

Can someone tell me how Arch measures my down speed? Where does the data the polybar module processes come from?

The module:

[module/wired-network]
type = internal/network
interface = name
interval = 3.0
format-connected =  <label-connected>
format-disconnected = <label-disconnected>
format-packetloss = <label-connected>

; Default: %ifname% %local_ip%
label-connected =  %downspeed:9%
label-connected-foreground = #eefafafa

; Default: (none)
label-disconnected = not connected
label-disconnected-foreground = #66ffffff

I asked the maintainer, he has no clue either. That's why I'm hoping you guys on here can help me.

Offline

#2 2021-11-14 22:43:58

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,223

Re: How does Arch Linux measure download speed?

https://github.com/polybar/polybar/blob … rs/net.cpp looks like it's polling  /sys/class/net/*/statistics/

What do you mean "the maintainer" has no clue? Do you think it's a good idea to use software where the person in charge doesn't know how it works?
Also

interface = name

looks garbage, according to https://github.com/polybar/polybar/wiki/Module:-network this should be some valid interface name. So I guess you're seeing some placeholder value (possibly driven by the suspiciously equal interval…)

Offline

#3 2021-11-14 22:59:00

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: How does Arch Linux measure download speed?

Tyskr wrote:

If I do test it with external speedtests, it always shows above 500 MB/s.

Off topic but where on earth do you live where you can get a 4000Mb/s internet connection?


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#4 2021-11-14 23:00:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: How does Arch Linux measure download speed?

More specifically here it is reporting the actual download rate ... meaning the amount of bytes your system is actually downloading over a given time.  Speedtests have an entirely different purpose of estimating your maximum capacity download rate.  So these are really apples and oranges.

Theoretically, the polybar module should report comparable speed values over the specific duration of time that the external speed test is running as the speed test (attempts to) saturate your connection*. Similarly the polybar module should report comparable speed anytime you've saturated your network connection with any other operations (pacman system upgrade with multiple connections).

But then also note potential differences between MBps and Mbps.  I would be quite surprised if any speed test said you were getting 500 MBps (if they did, I want your ISP ... or really, I'd sooner assume the speed test lied - did you happen to use a speed test provided by your ISP).

* Edit: and in reality, this is not likely to even happen as the polybar statistics may be collected with a longer sample duration.  The speedtests only need to saturate your download connection briefly to get a semi-reasonable estimate of your bandwidth.  But if this saturation does not cover the entire sampling window of the polybar monitor, polybar will show a substantially lower average rate over that time period.

Last edited by Trilby (2021-11-14 23:04:45)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2021-11-15 11:15:00

Tyskr
Member
Registered: 2019-12-11
Posts: 67

Re: How does Arch Linux measure download speed?

seth wrote:

https://github.com/polybar/polybar/blob … rs/net.cpp looks like it's polling  /sys/class/net/*/statistics/

Thank you, I will look into that.

What do you mean "the maintainer" has no clue? Do you think it's a good idea to use software where the person in charge doesn't know how it works?

nono, the maintainer is very capable and helpful. But I guess he does not have an answer to everything?

Also

interface = name

looks garbage, according to https://github.com/polybar/polybar/wiki/Module:-network this should be some valid interface name. So I guess you're seeing some placeholder value (possibly driven by the suspiciously equal interval…)

I put my real interface name there, problem still remains the same.

Offline

#6 2021-11-15 11:36:21

Tyskr
Member
Registered: 2019-12-11
Posts: 67

Re: How does Arch Linux measure download speed?

Slithery wrote:
Tyskr wrote:

If I do test it with external speedtests, it always shows above 500 MB/s.

Off topic but where on earth do you live where you can get a 4000Mb/s internet connection?

Whoops, it is 500Mb/s of course.

Offline

#7 2021-11-15 12:42:17

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,223

Re: How does Arch Linux measure download speed?

Let's get a realistic estimation, skipping weird online web-speedtests

wget -O /dev/null http://speedtest.frankfurt.linode.com/1GB-frankfurt.bin # I chose frankfurt because I speak enough danish…
wget -O ~/1GB-frankfurt.bin http://speedtest.frankfurt.linode.com/1GB-frankfurt.bin

What speed does wget report, does it matter whether you're downloading into dev/null or some actual file (slow disk issue)?
What does the polybar module report during this?

Offline

#8 2021-11-15 13:40:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: How does Arch Linux measure download speed?

Ah ... was my post ignored?  These are not expected to show even remotely close to similar results.  So the fact that they don't doesn't indicate anything out of the ordinary.  EDIT: comparing polybar and wget results with the above test may be relevant, but the sampling rate is still an issue that could scew the polybar data quite a bit (I suppose a 1GB test should last long enough to cover any reasonable sampling interval).

Last edited by Trilby (2021-11-15 13:43:10)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2021-11-15 18:07:21

Tyskr
Member
Registered: 2019-12-11
Posts: 67

Re: How does Arch Linux measure download speed?

seth wrote:

Let's get a realistic estimation, skipping weird online web-speedtests

wget -O /dev/null http://speedtest.frankfurt.linode.com/1GB-frankfurt.bin # I chose frankfurt because I speak enough danish…
wget -O ~/1GB-frankfurt.bin http://speedtest.frankfurt.linode.com/1GB-frankfurt.bin

What speed does wget report, does it matter whether you're downloading into dev/null or some actual file (slow disk issue)?
What does the polybar module report during this?

Interesting..

wget -O /dev/null http://speedtest.frankfurt.linode.com/1GB-frankfurt.bin

reports ~ 100Mb/s. Doesn't matter if I download into some actual file, no difference here.

That is quite low, a 10th of what my ISP is promising me haha. How accurate is this though? I never tested my download speed with wget, only used 'weird online web-speedtests'. How come the latter shows me 800Mb/s?

The polybar module reacts accordingly to the wget command.

Offline

#10 2021-11-15 18:19:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: How does Arch Linux measure download speed?

No, again, MB/s != Mb/s.  Wget reports the former which is 1/8th of the latter.  So if the MB/s reported by wget is 1/10th the value of Mbps your ISP is promising, you're actually in great shape getting 80% of the theoretical maximum (most of us don't get close to that).

And wget reported 100MB/s is exactly the same as what you report from other online tests saying you're getting 800Mb/s.

Last edited by Trilby (2021-11-15 18:21:30)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2021-11-15 18:22:58

Tyskr
Member
Registered: 2019-12-11
Posts: 67

Re: How does Arch Linux measure download speed?

Trilby wrote:

No, again, MB/s != Mb/s.  Wget reports the former which is 1/8th of the latter.  So if the MB/s reported by wget is 1/10th the value of Mbps your ISP is promising, you're actually in great shape getting 80% of the theoretical maximum (most of us don't get close to that).

And wget reported 100MB/s is exactly the same as what you report from other online tests saying you're getting 800Mb/s.

Today I learned.

Offline

#12 2021-11-15 18:26:21

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: How does Arch Linux measure download speed?

1B=8b


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#13 2021-11-15 18:30:55

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,690

Re: How does Arch Linux measure download speed?

Slithery wrote:

1B=8b

Not counting overhead.  I usually figure a couple extra bits per byte for the protocol.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB