About Me

My photo
My name is Vadim Hudolozhkin.

I enjoy studying science and the philosophy behind it. Here I'll be discussing my ideas on programming, mathematics, philosophy, trading, staying fit, dieting, computers, and just about anything else I find interesting. Ideally this blog will serve as a repository of wisdom for myself and others. Enjoy and share some ideas!

Wednesday, February 18, 2015

"Why are my downloads so much slower than my speed tests?"

Aha but speed tests and downloads are measured differently!

I've seen a bunch of bologna online where people say that speed tests at sites like speedtest.net aren't accurate because your evil ISP will allow uncapped access to that specific site, but otherwise cap your speeds. I work for a small ISP, and that is absolutely not a thing ISPs care about (at least not this one). 

When you perform a speed test, it'll be measured in megabits per second, where as when you're downloading a file your browser or downloading client program will typically measure the speed in megabytes per second. Before I explain why this makes sense let's break down the verbiage so everyone's on the same page.

Downloads 101

As many of you know, computers communicate in 1s and 0s, aka binary! Each one or zero is a bit. Traditional computers have no smaller measurement of data. There's a tiny switch, and it's either on, or off. One for on, zero for off.

Eight bits is equal to one byte. In an IP there are four numbers separated by periods(or decimal points), such as 192.168.1.1. Each number can be anywhere from 0 to 255, and the reason is because each number in this context is an octet, meaning it's eight bits long, or one byte. All the networking protocols on all the networking devices expect eight bits in each octet, so if you try something weird, it just won't work.

I know this seems like a tangent but bear with me. Let's have eight zeros, 00000000. < That's an octet! The value for that octet is 0! Let's have eight 1s, 11111111. < That's also an octet! The value for this octet is 255! So the highest value IP you can have is 255.255.255.255.

Since we can't add another digit, or a larger number(because it's binary, 1s and 0s only) 255 is the highest number you can make with eight bits. Sprinkling zeros in this octet will get you any number between 0 and 255 (We don't talk about 256). Making more sense now?

'So what? What are you getting at V?'

Well these eight bits can also make letters! ASCII is a standard used by computer for this very thing! 128 characters including numbers, letters, and punctuation are all made with only eight bits! So the letter A is one byte, the letter B is another byte. Other standards like Unicode can use more bytes per character.

Now that we know what a bit and a byte is, let's get back to the matter at hand.

A is a byte, B is a byte, CAT is 3 bytes, SWEET is 4 bytes, you're getting this right?

Alright well 1024 bytes is equal to 1 kilobyte(KB).
1024 kilobytes makes 1 megabyte(MB).
1024 megabytes makes 1 gigabyte(GB).
1024 gigabytes makes 1 terabyte(TB).
1024 terabytes makes 1 petabyte(PB).

It just keeps going, after petabyte comes exabyte, then zettabyte, then yottabyte. There are some great 'orders of magnitude' illustrations on the web to give some perspective on how much a petabyte really is. I remember hearing that every word ever spoken in all of history could be stored in less than four exabytes.

We use similar wording for bits! 10 bits is a decabit, 100 is a hectobit, 1000 is a kilobit, and 1,000,000 is a megabit.

A megabyte is roughly 1,000,000 bytes! To get the number of bits, you'd multiply that number by eight, which would give you 8,000,000 bits!

Now the difference between speed tests and downloads should make sense.

50 megabits per second on a speed test, is really about 6 megabytes per second.

It makes sense to have a speed test be in bits, because it would be much more accurate than a test in bytes, unless you were provided some extra decimal places on a byte reading. What would give you a more accurate reading for measuring distance, centimeters or kilometers? If you couldn't measure past two decimal places, you would surely say centimeters! The same goes for megabits!

On the other hand it makes sense that a download is measured in megabytes, because the files we download and upload are usually huge if measured in bits. A 100 KB file would be 100,000,000 bits! But if the reading is in KB, then there's no crazy math to do, and you could easily approximate how long a download would take. You could definitely perform a speed test in megabytes and there are downloads that are measured in bits, but this is rarely convenient.

Before we finish let's also point out the abbreviations. If the names weren't similar and confusing enough, the abbreviation for megabyte is MB, while the abbreviation for megabit is Mb. Just one B changed from lower to upper case changes the actual value referenced dramatically!

Luckily there's typically enough context around what you're doing to discern between bits and bytes.

So there you go! Now you can calm your frustrated friends with this newfound wisdom.