Or, how fast is localhost?

iPerf is a command line tool that can be used to measure network throughput.

For example, if endpoint A is sending data to endpoint B, you can use iPerf to determine how many bytes/second endpoint A can send, and how many bytes/second endpoint B can receive.

The rates should be similar due to TCP congestion control, which limits the number of un-acked segments that can be sent. From what I’ve observed, if the rates are unequal, the sender rate will be higher than the receiver rate, which makes sense since the sender can send some number of un-acked segments.


Run this on the same computer in two separate terminal tabs/windows.

Server side

  • -s means “run in server mode”
  • -p dictates the port to listen on

Client Side

  • -c means “run in client mode”
  • -p dictates the port to connect to
  • -f M formats the output in MBytes (megabytes)

Interpreting the Results

What do these numbers actually mean?

The main rows of importance are the ones at the bottom:

This tells us that the sender, which is the “client” side, is able to send data at a rate of 4699 MBytes/sec. You can think of this as the upload speed from client to server.

The receiver, which is the “server” side, is able to receive data at a rate of 4699 MBytes/sec. You can think of this as the server’s download speed.

So, how fast is localhost?

The answer is now right in front of us — using localhost, we can transfer data at a rate of ~5 gigabytes/second!

A nifty application of this tool is to pair it with port forwarding. For example, you can pair it with an SSH tunnel. First, create an SSH tunnel.

Then, you can run iPerf on the remote server and on your local machine to measure the throughput on both sides.

Lastly, there are lots of useful options, which you can see by running:


  1. https://iperf.fr/iperf-download.php (download link)
  2. https://en.wikipedia.org/wiki/Iperf
  3. https://github.com/esnet/iperf/issues/480

Software Engineer. Tweeting @pencilflip. Mediocre boulderer, amateur tennis player, terrible at Avalon. https://www.mattlim.me/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store