# mbits or mbytes?



## wolffnx (Feb 16, 2018)

this question is not about FreeBSD, is a network question..

I'have a proxy, with tools like `Iftop` for watch the real time network activity
for years , use Mbits for see the proxy activity (download speed,clients/etc)
but if i'am wrong the real speed is Mbytes per second?

I do not know if my question is understood, i should use Mbytes or Mbits per second?

for example, when i download someting from a web browser,the speed is show in MBytes


----------



## SirDice (Feb 16, 2018)

Network related speeds are typically indicated in bits per second. But for us humans bytes per second make more sense.

https://en.wikipedia.org/wiki/Bit_rate


----------



## drhowarddrfine (Feb 16, 2018)

Everything I say and read is in bps.


----------



## wolffnx (Feb 16, 2018)

mmm so, is a personal choise , for example `systat -ifstat` shows in bytes

i say this because i want to test the download speed from my work ISP
with this tool speedtest.py

the results in bits:


```
Testing download speed................................................................................

Download: 26.70 Mbit/s

Testing upload speed................................................................................................

Upload: 9.36 Mbit/s
```

and the results in bytes

```
Testing download speed................................................................................
Download: 3.19 Mbyte/s
Testing upload speed................................................................................................
Upload: 1.26 Mbyte/s
```

i feel like in the matrix


----------



## leebrown66 (Feb 16, 2018)

Which is why I use this instead:
`systat -ifstat -scale mbit`

And then some coders decide to divide by 1000, some 1024


----------



## phoenix (Feb 16, 2018)

leebrown66 said:


> Which is why I use this instead:
> `systat -ifstat -scale mbit`
> 
> And then some coders decide to divide by 1000, some 1024



And some divide by 8 to get MBytes/sec (how much user data is sent), while others divide by 10 to get MBytes/sec (how many physical bits are sent on the wire) due to every 8 bits of data requiring 10 bits be sent on the wire (8b/10b coding for Ethernet).  

Both of these are technically correct, depending on what you are measuring:  10 Mbit/sec == 1.25 Mbyte/sec or 1 Mbyte/sec.

Isn't networking fun?


----------



## wolffnx (Feb 17, 2018)

phoenix said:


> And some divide by 8 to get MBytes/sec (how much user data is sent), while others divide by 10 to get MBytes/sec (how many physical bits are sent on the wire) due to every 8 bits of data requiring 10 bits be sent on the wire (8b/10b coding for Ethernet).
> 
> Both of these are technically correct, depending on what you are measuring:  10 Mbit/sec == 1.25 Mbyte/sec or 1 Mbyte/sec.
> 
> *Isn't networking fun? *



indeed ,the fun never ends


----------



## SirDice (Feb 18, 2018)

phoenix said:


> 8b/10b coding for Ethernet


This is still the case for the traditional serial communications too, 1 start bit, 8 bits data, 1 stop bit. I've generally just taken a factor of 10 for pretty much everything when converting between bits and bytes. It's easier to calculate in your head and you usually need to account for some protocol overhead anyway.



leebrown66 said:


> And then some coders decide to divide by 1000, some 1024


Not so much driven by the coders but more by standards. The SI standards define kilo, mega, giga, etc, as factors of 1000. Telecoms have always used factors of 1000. So 1Gbps is really 1000000000 bits per second, not 1073741824 bits per second. Harddisk manufacturers are also bound by the SI standards, so again a 1 GB harddisk is 1000000000 bytes, not 1073741824.

https://en.wikipedia.org/wiki/Binary_prefix#Deviation_between_powers_of_1024_and_powers_of_1000


----------

