Bandwidth is the capacity of a link, like the width of a road. Throughput is how much data actually gets through, which depends on latency, packet loss, the other end and TCP behaviour. A server on a 1 Gbps port can easily show 200 Mbps in a careless test. This guide shows how to measure properly.
Before you start
- SSH access to a Linux VPS.
- Read port speed vs bandwidth and incoming vs outgoing traffic for the terms.
- Remember that tests use traffic from your monthly allowance.
Why throughput is lower than bandwidth
- Latency: a single TCP stream can only have so much data in flight. Over 150 ms, one stream may top out far below the port speed. Multiple streams fix this.
- Packet loss: even 1% loss makes TCP slow down sharply (see MTR report).
- The slowest link wins: your home connection, the remote server or a congested route.
- Disk and CPU: a download written to slow disk measures the disk, not the network.
- Bits vs bytes: 1 Gbps ≈ 119 MB/s at most. Browsers show MB/s.
Quick test with speedtest
sudo apt install speedtest-cli
speedtest-cli --simpleThis tests to the nearest public Speedtest server. Useful as a sanity check, but the result depends on that server.
Test a download with curl
curl -o /dev/null -w "speed: %{speed_download} bytes/s\n" https://SPEEDTEST-FILE-URLWriting to /dev/null takes the disk out of the measurement. Use a large test file from a provider near the server.
Accurate test between two machines with iperf3
- Install iperf3 on both machines (
apt install iperf3ordnf install iperf3). - On the server, start a listener and open its port temporarily:
sudo ufw allow 5201/tcp
iperf3 -s- On the other machine, test upload, then download with
-R, then with 8 parallel streams:
iperf3 -c SERVER-IP -t 20
iperf3 -c SERVER-IP -t 20 -R
iperf3 -c SERVER-IP -t 20 -P 8- Stop the server with Ctrl+C and remove the firewall rule:
sudo ufw delete allow 5201/tcp.
Read the results
- Parallel much faster than single stream: latency limits one stream. Normal over long distances.
- Many
Retr(retransmissions): packet loss or an MTU issue (troubleshoot MTU problems). - One direction slow: often your home upload speed, or an asymmetric route.
Tip: On a modern kernel, enabling BBR congestion control can help long-distance throughput: sysctl net.ipv4.tcp_congestion_control=bbr. Test before and after.
Troubleshooting
- iperf3 connection refused: the listener is not running or the port is closed (UFW rules).
- Website feels slow but iperf3 is fast: the network is fine; look at the application and caching.
