Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

7.3 (8 of 8): Bandwidth and latency

The whole lesson, free. Read it and have a go at the activities. To work the tasks and labs in the real lesson, press Start lab, with no account needed.

45 minutes

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

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

WordWhat it meansExample
BandwidthHow much data a connection carries each second.100 Mbps
LatencyThe time one piece of data takes to arrive.30 ms
BitOne 1 or 0, the smallest unit of data.1
ByteA group of 8 bits.One letter
MbpsMegabits per second, the unit of bandwidth.80 Mbps
MillisecondOne thousandth of a second, written ms.30 ms
PingA test that times the reply to a small message.ping 10.0.12.1
PacketA small, addressed piece of data sent over a network.One part of a photo
RouterA device that joins networks and sends packets the right way.A home router
NetworkComputers 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

BandwidthLatency
In the pictureHow many lanes the road hasHow long the road is
MeaningHow much data per secondHow long one packet takes to arrive
UnitMbps or GbpsMilliseconds (ms)
Good isHigh (more lanes)Low (a shorter road)
Hurts mostBig downloads and streamingGames, video calls and remote desktops

The cells students fill in are left blank in this preview.

Quick check

Have a go

Quick check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Extra: 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

StepWhat to doResult
1The file is 100 MB. The line is 80 Mbps.
2Change megabytes to megabits: 100 times 8800 megabits
3Divide by the speed: 800 divided by 8010 seconds
4Check: 10 seconds at 80 Mbps is 800 megabitsIt matches

The cells students fill in are left blank in this preview.

Extra: Try it: download time

Code: python
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

Command
sudo ip netns exec h1 ping -c 4 -W 1 10.0.12.1

A command for the lesson’s lab terminal. It is shown here and not run.

Extra: Read the summary line

Command
sudo ip netns exec h1 ping -c 5 -W 1 10.0.12.1 | tail -2

A 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

SystemNeeds mostWhy
Streaming filmBandwidthA lot of data every second
Online gameLow latencyEach move must arrive at once
Video callBothVideo needs bandwidth, and talking needs low latency
Cloud backupBandwidthA very large amount of data
Remote desktopLow latencyTyping 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.

Code: python
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.

Code: python
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

Final check

5 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Teach this lesson with your class

On a college account your students work the tasks and the labs as well, and every mark is kept for you.