首页
学习
活动
专区
圈层
工具
发布
50 篇文章
1
Ubuntu环境使用TPC-DS工具生成测试数据
2
cookie机制及其原理
3
网络测试,带宽测试,流量测试
4
使Edge浏览器打开仅支持IE兼容模式的网站
5
【Linux】挂载硬盘、镜像文件、rpm软件包管理器、yum软件包管理器、软件安装jdk、tomcat、mysql
6
【Spring Boot 项目创建】002-代码关联 Git 远程仓库
7
用ChatGPT生成测试数据
8
手机APP测试(测试点、测试流程、功能测试)
9
web前端好帮手 - Jest单元测试工具
10
用ChatGPT生成测试数据
11
Redis 精简笔记
12
一句话就能提Bug,这个自动提交Bug Skill 太好用了
13
从0到1做出可复用的 iOS 自动化测试 Skill,附真机演示效果
14
大厂测开面试都在问AI,这个实战项目直接帮你准备好了
15
OpenClaw 拿什么吃掉测试岗?
16
一篇理清Prompt,Skill,MCP之间的区别
17
AI 测试必备:推荐一款能让自动化失败脚本「自己修好」的 AI skill!
18
【Selenium 自学系列】(一)看源码分析交互原理
19
什么是CI/CD
20
这到底是前端还是后端Bug
21
详解接口测试(2)- HTTP接口用例设计与测试方法(拿B站练手)
22
比羊了个羊还火的ChatGPT,玩法全攻略讲解
23
爱心代码文字升级版
24
自动打包、装机、生成用例、真机回归,AI 测试流水线终于跑通了
25
AI生成注册用户测试用例
26
AI驱动的测试报告分析:从数据中挖掘测试洞察
27
WEB功能测试说明
28
APP功能测试要点
29
不输ChatGPT,kimi秒画流程图
30
聊天功能如何测试?
31
订单支付功能测试
32
app功能测试--需要测试哪些要点
33
【软件测试】使用QTP进行功能测试
34
TestZeus Hercules:功能测试写 Gherkin,让 AI Agent 去跑冒烟流程
35
非功能需求的测试
36
【功能篇】如何测试报表?
37
VFP AI 插件(ver:20251007)测试报告
38
VFP AI 插件使用指南(三)
39
「 支付功能 」的测试思路
40
研发、测试提效攻略:利用Apipost AI 6 大核心功能实现接口测试全流程
41
功能测试之app测试要点提取与分析
42
网站测试中短信发送功能测试点
43
常用功能的测试用例
44
20行代码,用Python实现异常测试用例
45
新梦想干货——软件测试中的43个功能测试点(下)
46
《打造你的 AI 知识库:用 Skill 实现项目文档的自动生成与维护》
47
Apifox和Apipost:2025 API工具巅峰对决
48
接口测试--apipost接口断言详解
49
ApiPost自动化测试基础之:如何使用测试校验(测试用例)?
50
教你用 Node.js 模拟自动发送邮件验证码
清单首页测试文章详情

网络测试,带宽测试,流量测试

节选自《Netkiller Testing 手札》网络测试章节

第 14 章 网络测试

目录

  • 14.1. iperf3 - perform network throughput tests
    • 14.1.1. Server
    • 14.1.2. Client
  • 14.2. Clumsy 差网络环境模拟工具

14.1. iperf3 - perform network throughput tests

Measurement tool for TCP/UDP bandwidth performance

Iperf is a tool to measure maximum TCP bandwidth, allowing the tuning of various parameters and UDP characteristics. Iperf reports bandwidth, delay jitter, data-gram loss.

iperf3 的使用非常简单,需要两台电脑,一台作为 server,另一台作为 client,启动有发送数据,将结果反馈给用户

代码语言:javascript
代码运行次数:0
复制
		iperf3: parameter error - must either be a client (-c) or server (-s)

Usage: iperf [-s|-c host] [options]
       iperf [-h|--help] [-v|--version]

Server or Client:
  -p, --port      #         server port to listen on/connect to
  -f, --format    [kmgKMG]  format to report: Kbits, Mbits, KBytes, MBytes
  -i, --interval  #         seconds between periodic bandwidth reports
  -F, --file name           xmit/recv the specified file
  -A, --affinity n/n,m      set CPU affinity
  -B, --bind      <host>    bind to a specific interface
  -V, --verbose             more detailed output
  -J, --json                output in JSON format
  -d, --debug               emit debugging output
  -v, --version             show version information and quit
  -h, --help                show this message and quit
Server specific:
  -s, --server              run in server mode
  -D, --daemon              run the server as a daemon
  -1, --one-off             handle one client connection then exit
Client specific:
  -c, --client    <host>    run in client mode, connecting to <host>
  -u, --udp                 use UDP rather than TCP
  -b, --bandwidth #[KMG][/#] target bandwidth in bits/sec (0 for unlimited)
                            (default 1 Mbit/sec for UDP, unlimited for TCP)
                            (optional slash and packet count for burst mode)
  -t, --time      #         time in seconds to transmit for (default 10 secs)
  -n, --bytes     #[KMG]    number of bytes to transmit (instead of -t)
  -k, --blockcount #[KMG]   number of blocks (packets) to transmit (instead of -t or -n)
  -l, --len       #[KMG]    length of buffer to read or write
                            (default 128 KB for TCP, 8 KB for UDP)
  -P, --parallel  #         number of parallel client streams to run
  -R, --reverse             run in reverse mode (server sends, client receives)
  -w, --window    #[KMG]    set window size / socket buffer size
  -C, --linux-congestion <algo>  set TCP congestion control algorithm (Linux only)
  -M, --set-mss   #         set TCP maximum segment size (MTU - 40 bytes)
  -N, --nodelay             set TCP no delay, disabling Nagle's Algorithm
  -4, --version4            only use IPv4
  -6, --version6            only use IPv6
  -S, --tos N               set the IP 'type of service'
  -L, --flowlabel N         set the IPv6 flow label (only supported on Linux)
  -Z, --zerocopy            use a 'zero copy' method of sending data
  -O, --omit N              omit the first n seconds
  -T, --title str           prefix every output line with this string
  --get-server-output       get results from server

[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-

iperf3 homepage at: http://software.es.net/iperf/
Report bugs to:     https://github.com/esnet/iperf				

14.1.1. Server

代码语言:javascript
代码运行次数:0
复制
[root@localhost ~]# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 127.0.0.1, port 38188
[  5] local 127.0.0.1 port 5201 connected to 127.0.0.1 port 38189
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-1.00   sec  4.74 GBytes  40.7 Gbits/sec                  
[  5]   1.00-2.00   sec  5.00 GBytes  43.0 Gbits/sec                  
[  5]   2.00-3.00   sec  5.00 GBytes  42.9 Gbits/sec                  
[  5]   3.00-4.00   sec  5.02 GBytes  43.1 Gbits/sec                  
[  5]   4.00-5.00   sec  5.02 GBytes  43.2 Gbits/sec                  
[  5]   5.00-6.00   sec  5.02 GBytes  43.1 Gbits/sec                  
[  5]   6.00-7.00   sec  5.05 GBytes  43.4 Gbits/sec                  
[  5]   7.00-8.00   sec  5.02 GBytes  43.1 Gbits/sec                  
[  5]   8.00-9.00   sec  5.08 GBytes  43.6 Gbits/sec                  
[  5]   9.00-10.00  sec  5.03 GBytes  43.2 Gbits/sec                  
[  5]  10.00-10.04  sec   196 MBytes  43.3 Gbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  5]   0.00-10.04  sec  50.2 GBytes  42.9 Gbits/sec    0             sender
[  5]   0.00-10.04  sec  50.2 GBytes  42.9 Gbits/sec                  receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------			

输出JSON格式的报告

代码语言:javascript
代码运行次数:0
复制
[root@localhost ~]# iperf3 -s --json
{
	"start":	{
		"connected":	[{
				"socket":	5,
				"local_host":	"127.0.0.1",
				"local_port":	5201,
				"remote_host":	"127.0.0.1",
				"remote_port":	38191
			}],
		"version":	"iperf 3.0.11",
		"system_info":	"Linux localhost.localdomain 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux\n",
		"timestamp":	{
			"time":	"Fri, 24 Jun 2016 08:12:35 GMT",
			"timesecs":	1466755955
		},
		"accepted_connection":	{
			"host":	"127.0.0.1",
			"port":	38190
		},
		"cookie":	"localhost.localdomain.1466755955.214",
		"tcp_mss_default":	21888,
		"test_start":	{
			"protocol":	"TCP",
			"num_streams":	1,
			"blksize":	131072,
			"omit":	0,
			"duration":	10,
			"bytes":	0,
			"blocks":	0,
			"reverse":	0
		}
	},
	"intervals":	[{
			"streams":	[{
					"socket":	5,
					"start":	0,
					"end":	1.00002,
					"seconds":	1.00002,
					"bytes":	5104271292,
					"bits_per_second":	4.08333e+10,
					"omitted":	false
				}],
			"sum":	{
				"start":	0,
				"end":	1.00002,
				"seconds":	1.00002,
				"bytes":	5104271292,
				"bits_per_second":	4.08333e+10,
				"omitted":	false
			}
		}, {
			"streams":	[{
					"socket":	5,
					"start":	1.00002,
					"end":	2.00002,
					"seconds":	1,
					"bytes":	5400688104,
					"bits_per_second":	43205504832,
					"omitted":	false
				}],
			"sum":	{
				"start":	1.00002,
				"end":	2.00002,
				"seconds":	1,
				"bytes":	5400688104,
				"bits_per_second":	43205504832,
				"omitted":	false
			}
		}, {
			"streams":	[{
					"socket":	5,
					"start":	2.00002,
					"end":	3.00002,
					"seconds":	0.999996,
					"bytes":	5386797056,
					"bits_per_second":	4.30946e+10,
					"omitted":	false
				}],
			"sum":	{
				"start":	2.00002,
				"end":	3.00002,
				"seconds":	0.999996,
				"bytes":	5386797056,
				"bits_per_second":	4.30946e+10,
				"omitted":	false
			}
		}, {
			"streams":	[{
					"socket":	5,
					"start":	3.00002,
					"end":	4.00002,
					"seconds":	1,
					"bytes":	5392957440,
					"bits_per_second":	4.31435e+10,
					"omitted":	false
				}],
			"sum":	{
				"start":	3.00002,
				"end":	4.00002,
				"seconds":	1,
				"bytes":	5392957440,
				"bits_per_second":	4.31435e+10,
				"omitted":	false
			}
		}, {
			"streams":	[{
					"socket":	5,
					"start":	4.00002,
					"end":	5.00003,
					"seconds":	1.00001,
					"bytes":	5422972928,
					"bits_per_second":	4.33836e+10,
					"omitted":	false
				}],
			"sum":	{
				"start":	4.00002,
				"end":	5.00003,
				"seconds":	1.00001,
				"bytes":	5422972928,
				"bits_per_second":	4.33836e+10,
				"omitted":	false
			}
		}, {
			"streams":	[{
					"socket":	5,
					"start":	5.00003,
					"end":	6,
					"seconds":	0.999978,
					"bytes":	5445845060,
					"bits_per_second":	4.35677e+10,
					"omitted":	false
				}],
			"sum":	{
				"start":	5.00003,
				"end":	6,
				"seconds":	0.999978,
				"bytes":	5445845060,
				"bits_per_second":	4.35677e+10,
				"omitted":	false
			}
		}, {
			"streams":	[{
					"socket":	5,
					"start":	6,
					"end":	7.00003,
					"seconds":	1.00003,
					"bytes":	5420875776,
					"bits_per_second":	4.33657e+10,
					"omitted":	false
				}],
			"sum":	{
				"start":	6,
				"end":	7.00003,
				"seconds":	1.00003,
				"bytes":	5420875776,
				"bits_per_second":	4.33657e+10,
				"omitted":	false
			}
		}, {
			"streams":	[{
					"socket":	5,
					"start":	7.00003,
					"end":	8.00001,
					"seconds":	0.999975,
					"bytes":	5389877180,
					"bits_per_second":	4.31201e+10,
					"omitted":	false
				}],
			"sum":	{
				"start":	7.00003,
				"end":	8.00001,
				"seconds":	0.999975,
				"bytes":	5389877180,
				"bits_per_second":	4.31201e+10,
				"omitted":	false
			}
		}, {
			"streams":	[{
					"socket":	5,
					"start":	8.00001,
					"end":	9.00001,
					"seconds":	1,
					"bytes":	5408030720,
					"bits_per_second":	4.32641e+10,
					"omitted":	false
				}],
			"sum":	{
				"start":	8.00001,
				"end":	9.00001,
				"seconds":	1,
				"bytes":	5408030720,
				"bits_per_second":	4.32641e+10,
				"omitted":	false
			}
		}, {
			"streams":	[{
					"socket":	5,
					"start":	9.00001,
					"end":	10,
					"seconds":	1.00001,
					"bytes":	5400166400,
					"bits_per_second":	4.32009e+10,
					"omitted":	false
				}],
			"sum":	{
				"start":	9.00001,
				"end":	10,
				"seconds":	1.00001,
				"bytes":	5400166400,
				"bits_per_second":	4.32009e+10,
				"omitted":	false
			}
		}, {
			"streams":	[{
					"socket":	5,
					"start":	10,
					"end":	10.0381,
					"seconds":	0.0380569,
					"bytes":	206635076,
					"bits_per_second":	4.34371e+10,
					"omitted":	false
				}],
			"sum":	{
				"start":	10,
				"end":	10.0381,
				"seconds":	0.0380569,
				"bytes":	206635076,
				"bits_per_second":	4.34371e+10,
				"omitted":	false
			}
		}],
	"end":	{
		"streams":	[{
				"sender":	{
					"socket":	5,
					"start":	0,
					"end":	10.0381,
					"seconds":	10.0381,
					"bytes":	53979117032,
					"bits_per_second":	4.30195e+10,
					"retransmits":	0
				},
				"receiver":	{
					"socket":	5,
					"start":	0,
					"end":	10.0381,
					"seconds":	10.0381,
					"bytes":	53979117032,
					"bits_per_second":	4.30195e+10
				}
			}],
		"sum_sent":	{
			"start":	0,
			"end":	10.0381,
			"seconds":	10.0381,
			"bytes":	53979117032,
			"bits_per_second":	4.30195e+10,
			"retransmits":	0
		},
		"sum_received":	{
			"start":	0,
			"end":	10.0381,
			"seconds":	10.0381,
			"bytes":	53979117032,
			"bits_per_second":	4.30195e+10
		},
		"cpu_utilization_percent":	{
			"host_total":	19.6287,
			"host_user":	0.628708,
			"host_system":	19.02,
			"remote_total":	99.411,
			"remote_user":	1.25979,
			"remote_system":	98.226
		}
	}
}			

14.1.2. Client

代码语言:javascript
代码运行次数:0
复制
[root@localhost ~]# iperf3 -c 127.0.0.1
Connecting to host 127.0.0.1, port 5201
[  4] local 127.0.0.1 port 38189 connected to 127.0.0.1 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  4.93 GBytes  42.4 Gbits/sec    0   1.19 MBytes       
[  4]   1.00-2.00   sec  5.00 GBytes  42.9 Gbits/sec    0   1.19 MBytes       
[  4]   2.00-3.00   sec  5.00 GBytes  42.9 Gbits/sec    0   1.19 MBytes       
[  4]   3.00-4.00   sec  5.02 GBytes  43.1 Gbits/sec    0   1.19 MBytes       
[  4]   4.00-5.00   sec  5.03 GBytes  43.2 Gbits/sec    0   1.19 MBytes       
[  4]   5.00-6.00   sec  5.02 GBytes  43.1 Gbits/sec    0   1.19 MBytes       
[  4]   6.00-7.00   sec  5.05 GBytes  43.4 Gbits/sec    0   1.19 MBytes       
[  4]   7.00-8.00   sec  5.02 GBytes  43.1 Gbits/sec    0   1.81 MBytes       
[  4]   8.00-9.00   sec  5.08 GBytes  43.6 Gbits/sec    0   1.81 MBytes       
[  4]   9.00-10.00  sec  5.03 GBytes  43.2 Gbits/sec    0   1.81 MBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  50.2 GBytes  43.1 Gbits/sec    0             sender
[  4]   0.00-10.00  sec  50.2 GBytes  43.1 Gbits/sec                  receiver

iperf Done.
下一篇
举报
领券