Fast downloads, but the game lags
Your friend says: "My internet is fast. I download a film in a minute. But my online game lags and my video call freezes."
Is the internet fast or slow? It depends on what you measure. A network is a group of computers joined together, and it has two different speeds.
Bandwidth is how much data a connection carries each second. Latency is how long one piece of data takes to arrive.
Key words
| Word | What it means | Example |
|---|---|---|
| Bandwidth | How much data a connection carries each second. | 100 Mbps |
| Latency | The time one piece of data takes to arrive. | 30 ms |
| Bit | One 1 or 0, the smallest unit of data. | 1 |
| Byte | A group of 8 bits. | One letter |
| Mbps | Megabits per second, the unit of bandwidth. | 80 Mbps |
| Millisecond | One thousandth of a second, written ms. | 30 ms |
| Ping | A test that times the reply to a small message. | ping 10.0.12.1 |
| Packet | A small, addressed piece of data sent over a network. | One part of a photo |
| Router | A device that joins networks and sends packets the right way. | A home router |
| Network | Computers joined to share data. | The college network |
The cells students fill in are left blank in this preview.
Bandwidth or latency?
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
Bandwidth is lanes, latency is length
| Bandwidth | Latency | |
|---|---|---|
| In the picture | How many lanes the road has | How long the road is |
| Meaning | How much data per second | How long one packet takes to arrive |
| Unit | Mbps or Gbps | Milliseconds (ms) |
| Good is | High (more lanes) | Low (a shorter road) |
| Hurts most | Big downloads and streaming | Games, video calls and remote desktops |
The cells students fill in are left blank in this preview.
Quick check
Have a go
Quick check
3 questionsExtra: Bits and bytes
File sizes use bytes. Line speeds use bits. One byte is 8 bits.
So a 100 MB file is 100 times 8, which is 800 megabits. That is why a 100 Mbps line does not download 100 MB in one second.
Extra: Small b or capital B?
Warning
Many people read Mb and MB as the same unit. A small b means bits and a capital B means bytes. So Mbps is megabits each second, and MB is megabytes. Check the letter, because shops and phones show both.
Extra: Worked example: download time
| Step | What to do | Result |
|---|---|---|
| 1 | The file is 100 MB. The line is 80 Mbps. | |
| 2 | Change megabytes to megabits: 100 times 8 | 800 megabits |
| 3 | Divide by the speed: 800 divided by 80 | 10 seconds |
| 4 | Check: 10 seconds at 80 Mbps is 800 megabits | It matches |
The cells students fill in are left blank in this preview.
Extra: Try it: download time
size_mb = 100 # file size in megabytes
speed_mbps = 80 # line speed in megabits per second
size_megabits = size_mb * 8
seconds = size_megabits / speed_mbps
print("The download takes", seconds, "seconds.")
# Change the speed to 160. What happens to the time?
Make a free account to save your work and track your progress.
Extra: Time some packets
sudo ip netns exec h1 ping -c 4 -W 1 10.0.12.1A command for the lesson’s lab terminal. It is shown here and not run.
Extra: Read the summary line
sudo ip netns exec h1 ping -c 5 -W 1 10.0.12.1 | tail -2A command for the lesson’s lab terminal. It is shown here and not run.
Extra: Reading ping
Note
Each reply line has time=. That is the latency to the router and back, in milliseconds. It is tiny here because the whole lab is inside one machine. Across the world, it can be 100 ms or more.
How they change performance
Low bandwidth makes big transfers slow. Many users on one line slow each other down. Streaming film buffers. Backups take all night.
High latency makes things feel slow, even for a small file. Games lag. Video calls have gaps. A remote desktop feels late when you type.
Many things change them: distance, the number of routers on the way, a busy network, and weak Wi-Fi.
Where each one matters
| System | Needs most | Why |
|---|---|---|
| Streaming film | Bandwidth | A lot of data every second |
| Online game | Low latency | Each move must arrive at once |
| Video call | Both | Video needs bandwidth, and talking needs low latency |
| Cloud backup | Bandwidth | A very large amount of data |
| Remote desktop | Low latency | Typing and clicking must feel instant |
The cells students fill in are left blank in this preview.
What helps?
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
Your turn: which one matters?
Write two functions. matters_most(activity) says if bandwidth, latency or both matter most for an activity. call_quality(latency_ms) gives back "good" for 50 ms or less, "ok" for 100 ms or less, and "poor" for more than that. These limits are only for this exercise. Press Run Tests to check.
def matters_most(activity):
# Give back "bandwidth" for "streaming film" and "cloud backup".
# Give back "latency" for "online game" and "remote desktop".
# Give back "both" for anything else.
return ""
def call_quality(latency_ms):
# Give back "good" up to 50 ms, "ok" up to 100 ms, and "poor" above that.
return ""
Make a free account to save your work, or press Start lab to work through the whole lesson.
Extra: Your turn: download time
Write a function. download_seconds(size_mb, speed_mbps) gives back the seconds a download takes. Remember that 1 byte is 8 bits. Press Run Tests to check.
def download_seconds(size_mb, speed_mbps):
# size_mb is the file size in megabytes. speed_mbps is the line speed in megabits per second.
# 1 byte is 8 bits. Give back how many seconds the download takes.
return 0
Make a free account to save your work, or press Start lab to work through the whole lesson.
Key words crossword
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
Final check
Have a go