0Pricing
Linux Networking & TCP/IP for Developers · 课时

网络吞吐量基准测试

使用工具和方法,在各种场景中准确测量和分析网络性能

网络吞吐量基准测试 是 CoddyKit 上的免费 Linux Networking & TCP/IP for Developers 课时。 这是第 3 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Linux Networking & TCP/IP for Developers 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Linux Networking & TCP/IP for Developers 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

Why Benchmark Network Speed?

Ever wonder if your internet connection is truly delivering what it promises? Or if your local network is a bottleneck?

Network benchmarking helps you measure and understand your network's actual performance. It's crucial for diagnosing slowdowns, verifying upgrades, or planning system deployments.

Key Throughput Metrics

When we talk about network performance, we often focus on these key metrics:

  • Throughput (Bandwidth): The amount of data transferred successfully per unit of time, usually measured in bits per second (bps) or bytes per second (Bps).
  • Latency: The time it takes for a data packet to travel from one point to another.
  • Jitter: The variation in latency over time.
  • Packet Loss: The percentage of data packets that fail to reach their destination.

For benchmarking, throughput is often the primary focus.

Introducing iperf3 for Throughput

iperf3 is a powerful command-line tool specifically designed for measuring maximum network throughput between two hosts.

It's widely used because it can test both TCP and UDP connections, show detailed statistics, and is available on almost all platforms, including Linux.

Setting Up iperf3 Server

To test network throughput with iperf3, you need two machines: one acting as a server and one as a client.

First, on one of your Linux machines (the 'server'), start iperf3 in server mode. It will listen for incoming connections.

iperf3 -s

Running a Basic iperf3 Client Test

Now, on your second Linux machine (the 'client'), run iperf3 in client mode, pointing it to the server's IP address.

This command will perform a default 10-second TCP test, sending data from the client to the server.

iperf3 -c <server_ip_address>

Interpreting iperf3 Output

After the test, both the client and server will display results. Look for the 'Bandwidth' column, which shows the throughput.

Key metrics in the output:

  • Interval: Time segments of the test.
  • Transfer: Total data sent/received in that interval.
  • Bandwidth: The average data rate for that interval.
  • Retr: Number of retransmitted packets (for TCP), indicating network issues.

Testing UDP Throughput and Loss

iperf3 can also test UDP performance, which is useful for applications like video streaming or VoIP where packet loss is more critical than retransmissions.

Use the -u flag on the client to switch to UDP mode. You can also specify a target bandwidth with -b.

iperf3 -c <server_ip_address> -u -b 100M

Maximizing Throughput with Parallel Streams

Sometimes, a single TCP stream might not fully utilize your network's capacity due to TCP windowing or latency.

You can use the -P flag to run multiple parallel streams simultaneously, which can reveal the true maximum throughput of your link.

iperf3 -c <server_ip_address> -P 4

Other iperf3 Options

iperf3 offers many other options for fine-tuning your tests:

  • -R: Reverse mode (server sends, client receives).
  • -t : Set test duration.
  • -i : Set interval for reporting.
  • -J: Output results in JSON format for scripting.

Always check iperf3 --help for a full list of options!

Quick Check on iperf3

You've run an iperf3 TCP test from a client to a server. The client output shows a 'Retr' count of 150. What does this indicate?

Recap: Benchmarking Throughput

In this lesson, we explored network throughput benchmarking. We learned:

  • Why benchmarking is essential for understanding network performance.
  • Key metrics like throughput, latency, jitter, and packet loss.
  • How to use iperf3 in both server and client modes.
  • Interpreting iperf3 results, including bandwidth and retransmissions.
  • Testing UDP performance and using parallel streams for maximum throughput.

Mastering iperf3 is a vital skill for any network professional or developer!

常见问题解答

「网络吞吐量基准测试」课时是免费的吗?

是的 — 「网络吞吐量基准测试」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Linux Networking & TCP/IP for Developers 课程的其余内容,请升级到 CoddyKit PRO。 Linux Networking & TCP/IP for Developers 课程共包含 4 节课。

「网络吞吐量基准测试」这节课中我会学到什么?

使用工具和方法,在各种场景中准确测量和分析网络性能 你通过在浏览器中直接运行的动手代码来练习 Linux Networking & TCP/IP for Developers,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 Linux Networking & TCP/IP for Developers 需要有经验吗?

无需任何先前经验。CoddyKit 上的 Linux Networking & TCP/IP for Developers 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 3 节课,共 4 节。

「网络吞吐量基准测试」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 Linux Networking & TCP/IP for Developers 课中编写并运行代码吗?

能。每节 Linux Networking & TCP/IP for Developers 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 内核网络参数
  2. NIC 调优与优化
  3. 网络吞吐量基准测试
  4. TCP 拥塞控制调优
← 返回 Linux Networking & TCP/IP for Developers