The basic commands are the same for iperf and iperf3:

SAMPLE IPERF/IPERF3 COMMANDS
Server:
iperf/iperf3 -s Start server on the default port
iperf -s -w 32M -D / iperf3 -s -D Start server with larger TCP window, and in daemon mode
iperf -i1 -u -s -p 5003 / iperf3 -s -p 5003 Start UDP server on port 5003, and give 1 sec interval reports
Client
iperf/iperf3 -c remotehost -i 1 -t 30 Run a 30 second tests, giving results every 1 second
iperff/iperf3 -c remotehost -i 1 -t 20 -r Run a test from remotehost to localhost
iperf/iperf3 -c remotehost -i 1 -t 20 -w 32M -P 4 Run a test with 4 parallel streams, and with a 32M TCP buffer
iperf/iperf3 -c remotehost -u -i 1 -b 200M  Run a 200 Mbps UDP test
 

iperf3 adds a number of additional features. For example, the -i mode now reports TCP retransmit info (and is on by default), and the verbose mode now gives a lot of useful information on CPU usage, etc. Other new options include:

NEW IPERF3 COMMANDS
Client:
iperf3 -c remotehost -i.5 -0 2 Run the test for 2 seconds before collecting results, to allow forTCP slowstart to finish. (Omit mode)
iperf3 -Z -c remotehost Use the sendfile() system call for "Zero Copy" mode. This uses much less CPU.
iperf3 -c 192.168.12.12 -T s1 & iperf3 -c 192.168.12.13 -T s2 Run tests to multiple interfaces at once, and label the lines to indicate which test is which
iperf3 -c remotehost -J Output the results in JSON format for easy parsing.
iperf3 -A 4,4 -c remotehost Set the CPU affinity for the sender,receiver (cores are numbered from 0). This has the same affect as doing 'numactl -C 4 iperf3'.

iperf3 -c 10.20.1.20 -A2,2 -T "1" & ; iperf3 -c 10.20.1.20 -p 5400 -A3,3 -T "2" &

Run 2 streams on 2 different cores, and label each using the "-T" flag.

iperf3 thread model

In order to keep the code as simple and maintainable as possible, iperf3 is single threaded. This means that that you may be CPU-bound on some hosts, or on 40G/100G NICs. To run parallel stream iperf3 on mutiple cores, use the method shown in the table above.

实践:

[root@CentOS7 iperf-3.1.2]# iperf3 -s

-----------------------------------------------------------

Server listening on 5201

-----------------------------------------------------------

Accepted connection from 192.168.56.106, port 58465

[  5] local 192.168.56.103 port 5201 connected to 192.168.56.106 port 58466

[ ID] Interval           Transfer     Bandwidth

[  5]   0.00-1.00   sec  49.9 MBytes   418 Mbits/sec

[  5]   1.00-2.00   sec   175 MBytes  1.47 Gbits/sec

[  5]   2.00-3.00   sec   148 MBytes  1.25 Gbits/sec

[  5]   3.00-4.00   sec   164 MBytes  1.38 Gbits/sec

[  5]   4.00-5.00   sec   234 MBytes  1.96 Gbits/sec

[  5]   5.00-6.00   sec   227 MBytes  1.91 Gbits/sec

[  5]   6.00-7.00   sec   222 MBytes  1.86 Gbits/sec

[  5]   7.00-8.00   sec   169 MBytes  1.42 Gbits/sec

[  5]   8.00-9.00   sec   143 MBytes  1.20 Gbits/sec

[  5]   9.00-10.00  sec   226 MBytes  1.90 Gbits/sec

[  5]  10.00-11.00  sec   189 MBytes  1.58 Gbits/sec

[  5]  11.00-12.00  sec   101 MBytes   850 Mbits/sec

[  5]  12.00-13.00  sec   188 MBytes  1.58 Gbits/sec

[  5]  13.00-14.00  sec   207 MBytes  1.74 Gbits/sec

[  5]  14.00-15.00  sec   215 MBytes  1.81 Gbits/sec

[  5]  15.00-16.00  sec   218 MBytes  1.83 Gbits/sec

[  5]  16.00-17.00  sec   217 MBytes  1.82 Gbits/sec

[  5]  17.00-18.00  sec   217 MBytes  1.82 Gbits/sec

[  5]  18.00-19.00  sec   169 MBytes  1.42 Gbits/sec

[  5]  19.00-20.00  sec   230 MBytes  1.93 Gbits/sec

[  5]  20.00-21.00  sec   228 MBytes  1.91 Gbits/sec

[  5]  21.00-22.00  sec   220 MBytes  1.85 Gbits/sec

[  5]  22.00-23.00  sec   227 MBytes  1.91 Gbits/sec

[  5]  23.00-24.00  sec   231 MBytes  1.94 Gbits/sec

[  5]  24.00-25.00  sec   232 MBytes  1.95 Gbits/sec

[  5]  25.00-26.00  sec   146 MBytes  1.23 Gbits/sec

[  5]  26.00-27.00  sec   200 MBytes  1.67 Gbits/sec

[  5]  27.00-28.00  sec   180 MBytes  1.51 Gbits/sec

[  5]  28.00-29.00  sec   176 MBytes  1.47 Gbits/sec

[  5]  29.00-30.00  sec   170 MBytes  1.43 Gbits/sec

[  5]  30.00-31.00  sec   217 MBytes  1.82 Gbits/sec

[  5]  31.00-32.00  sec   215 MBytes  1.80 Gbits/sec

[  5]  32.00-32.54  sec   116 MBytes  1.79 Gbits/sec

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bandwidth

[  5]   0.00-32.54  sec  0.00 Bytes  0.00 bits/sec                  sender

[  5]   0.00-32.54  sec  6.12 GBytes  1.62 Gbits/sec                  receiver

[root@CentOS6 iperf-3.1.2]# iperf3 -c 192.168.56.103 -i 1 -t 30
Connecting to host 192.168.56.103, port 5201
[  4] local 192.168.56.106 port 58466 connected to 192.168.56.103 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  59.3 MBytes   497 Mbits/sec  137    181 KBytes       
[  4]   1.00-2.00   sec   214 MBytes  1.80 Gbits/sec   46    211 KBytes       
[  4]   2.00-3.00   sec   129 MBytes  1.08 Gbits/sec    1   74.9 KBytes       
[  4]   3.00-4.00   sec   222 MBytes  1.86 Gbits/sec   46    209 KBytes       
[  4]   4.00-5.00   sec   253 MBytes  2.12 Gbits/sec    0    235 KBytes       
[  4]   5.00-6.00   sec   240 MBytes  2.01 Gbits/sec   45    187 KBytes       
[  4]   6.00-7.00   sec   249 MBytes  2.09 Gbits/sec    0    198 KBytes       
[  4]   7.00-8.00   sec   135 MBytes  1.14 Gbits/sec    1   80.6 KBytes       
[  4]   8.00-9.00   sec   210 MBytes  1.77 Gbits/sec   46    209 KBytes       
[  4]   9.00-10.00  sec   236 MBytes  1.98 Gbits/sec    0    233 KBytes       
[  4]  10.00-11.00  sec  94.7 MBytes   795 Mbits/sec   92   39.6 KBytes       
[  4]  11.00-12.00  sec   203 MBytes  1.71 Gbits/sec    0   94.7 KBytes       
[  4]  12.00-13.00  sec   225 MBytes  1.89 Gbits/sec    0    122 KBytes       
[  4]  13.00-14.00  sec   235 MBytes  1.97 Gbits/sec    0    144 KBytes       
[  4]  14.00-15.00  sec   236 MBytes  1.98 Gbits/sec    0    157 KBytes       
[  4]  15.00-16.00  sec   234 MBytes  1.96 Gbits/sec    0    164 KBytes       
[  4]  16.00-17.00  sec   185 MBytes  1.55 Gbits/sec   46    182 KBytes       
[  4]  17.00-18.00  sec   243 MBytes  2.04 Gbits/sec    0    219 KBytes       
[  4]  18.00-19.00  sec   252 MBytes  2.11 Gbits/sec   45    171 KBytes       
[  4]  19.00-20.00  sec   233 MBytes  1.96 Gbits/sec    0    191 KBytes       
[  4]  20.00-21.00  sec   251 MBytes  2.10 Gbits/sec    0    201 KBytes       
[  4]  21.00-22.00  sec   247 MBytes  2.07 Gbits/sec    0    206 KBytes       
[  4]  22.00-23.00  sec   252 MBytes  2.11 Gbits/sec    0    214 KBytes       
[  4]  23.00-24.00  sec   164 MBytes  1.38 Gbits/sec    1   66.5 KBytes       
[  4]  24.00-25.00  sec   214 MBytes  1.79 Gbits/sec    0    122 KBytes       
[  4]  25.00-26.00  sec   202 MBytes  1.69 Gbits/sec    0    164 KBytes       
[  4]  26.00-27.00  sec   197 MBytes  1.66 Gbits/sec    0    192 KBytes       
[  4]  27.00-28.00  sec   187 MBytes  1.57 Gbits/sec    1    148 KBytes       
[  4]  28.00-29.00  sec   235 MBytes  1.97 Gbits/sec    0    160 KBytes       
[  4]  29.00-30.00  sec   230 MBytes  1.93 Gbits/sec    0    170 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-30.00  sec  6.12 GBytes  1.75 Gbits/sec  507             sender
[  4]   0.00-30.00  sec  6.12 GBytes  1.75 Gbits/sec                  receiver
 
iperf Done.
 
[root@CentOS6 iperf-3.1.2]# iperf3 -c 192.168.56.103 -u -i 1 -b 200M
Connecting to host 192.168.56.103, port 5201
[  4] local 192.168.56.106 port 48953 connected to 192.168.56.103 port 5201
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  4]   0.00-1.00   sec  22.6 MBytes   189 Mbits/sec  2891  
[  4]   1.00-2.00   sec  24.0 MBytes   201 Mbits/sec  3068  
[  4]   2.00-3.00   sec  23.6 MBytes   198 Mbits/sec  3025  
[  4]   3.00-4.00   sec  23.8 MBytes   200 Mbits/sec  3043  
[  4]   4.00-5.00   sec  23.9 MBytes   200 Mbits/sec  3055  
[  4]   5.00-6.00   sec  23.9 MBytes   200 Mbits/sec  3059  
[  4]   6.00-7.00   sec  23.7 MBytes   199 Mbits/sec  3038  
[  4]   7.00-8.00   sec  23.9 MBytes   200 Mbits/sec  3055  
[  4]   8.00-9.00   sec  23.9 MBytes   200 Mbits/sec  3065  
[  4]   9.00-10.00  sec  23.9 MBytes   201 Mbits/sec  3053  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-10.00  sec   237 MBytes   199 Mbits/sec  0.027 ms  500/30352 (1.6%)  
[  4] Sent 30352 datagrams
 
iperf Done.
 

FAQ:

1.Q:[root@CentOS6 iperf-3.1.2]# iperf3 -c 192.168.56.103 -f M -i 2 -w 300K -n 100M -t 30 -d

iperf3: parameter error - only one test end condition (-t, -n, -k) may be specified
A:去掉-n
2.-d不再是双向,是debug,目前不支持双向,网上一些文章是错的。

Deprecated flags (currently no plans to support):

-d, --dualtest           Do a bidirectional test simultaneously
-r, --tradeoff Do a bidirectional test individually
-T, --ttl time-to-live, for multicast (default 1)
-x, --reportexclude [CDMSV] exclude C(connection) D(data) M(multicast)
S(settings) V(server) reports
-y, --reportstyle C report as a Comma-Separated Values

iperf3实践的更多相关文章

  1. webp图片实践之路

    最近,我们在项目中实践了webp图片,并且抽离出了工具模块,整合到了项目的基础模板中.传闻IOS10也将要支持webp,那么使用webp带来的性能提升将更加明显.估计在不久的将来,webp会成为标配. ...

  2. Hangfire项目实践分享

    Hangfire项目实践分享 目录 Hangfire项目实践分享 目录 什么是Hangfire Hangfire基础 基于队列的任务处理(Fire-and-forget jobs) 延迟任务执行(De ...

  3. TDD在Unity3D游戏项目开发中的实践

    0x00 前言 关于TDD测试驱动开发的文章已经有很多了,但是在游戏开发尤其是使用Unity3D开发游戏时,却听不到特别多关于TDD的声音.那么本文就来简单聊一聊TDD如何在U3D项目中使用以及如何使 ...

  4. Logstash实践: 分布式系统的日志监控

    文/赵杰 2015.11.04 1. 前言 服务端日志你有多重视? 我们没有日志 有日志,但基本不去控制需要输出的内容 经常微调日志,只输出我们想看和有用的 经常监控日志,一方面帮助日志微调,一方面及 ...

  5. 【大型网站技术实践】初级篇:借助Nginx搭建反向代理服务器

    一.反向代理:Web服务器的“经纪人” 1.1 反向代理初印象 反向代理(Reverse Proxy)方式是指以代理服务器来接受internet上的连接请求,然后将请求转发给内部网络上的服务器,并将从 ...

  6. Windows平台分布式架构实践 - 负载均衡

    概述 最近.NET的世界开始闹腾了,微软官方终于加入到了对.NET跨平台的支持,并且在不久的将来,我们在VS里面写的代码可能就可以通过Mono直接在Linux和Mac上运行.那么大家(开发者和企业)为 ...

  7. Mysql事务探索及其在Django中的实践(二)

    继上一篇<Mysql事务探索及其在Django中的实践(一)>交代完问题的背景和Mysql事务基础后,这一篇主要想介绍一下事务在Django中的使用以及实际应用给我们带来的效率提升. 首先 ...

  8. Mysql事务探索及其在Django中的实践(一)

    前言 很早就有想开始写博客的想法,一方面是对自己近期所学知识的一些总结.沉淀,方便以后对过去的知识进行梳理.追溯,一方面也希望能通过博客来认识更多相同技术圈的朋友.所幸近期通过了博客园的申请,那么今天 ...

  9. netty5 HTTP协议栈浅析与实践

      一.说在前面的话 前段时间,工作上需要做一个针对视频质量的统计分析系统,各端(PC端.移动端和 WEB端)将视频质量数据放在一个 HTTP 请求中上报到服务器,服务器对数据进行解析.分拣后从不同的 ...

随机推荐

  1. Divisors

    计算小于n的数中,约数个数最多的数,若有多个最输出最小的一个数. http://hihocoder.com/problemset/problem/1187 对于100有 60 = 2 * 2 * 3 ...

  2. Ubuntu远程连接windows

    一般情况下都是使用windows系统,通过mstsc远程连接linux系统,但对于一些linuxer来说,有时候需要远程连接一下windows,最后采用的是rdesktop,一个非常好用的工具 sud ...

  3. 回顾Spring框架

    Spring框架: 传统JavaEE解决企业级应用问题时的"重量级"架构体系,使它的开发效率,开发难度和实际的性能都令人失望.Spring是以一个 救世主的身份降临在广大的程序员面 ...

  4. Python 基礎 - 認識模塊

    什麼是模塊?簡單說就是別人寫好了一堆功能,封裝在一起. 模塊有分二種,一個是之前有提到的 標準庫,就是不需要透過額外的安裝就有的模塊 ,另一個叫 第三方庫,需要另外安裝才能使用的模塊 #!/usr/b ...

  5. Filco minila 的蛋疼。

    3494左shift坏了,期间邮寄厂家维修,就把尘封多年的minila拿出来用着. 最为人诟病的问题:蓝亚适配,与mac跟iphone都能快速的匹配连接上.但是对于我的dell vestro 2012 ...

  6. python数据结构与算法——字典树

    class TrieTree(): def __init__(self): self.root = {} def addNode(self,str): # 树中每个结点(除根节点),包含到该结点的单词 ...

  7. Erlang 104 OTP

    笔记系列 Erlang环境和顺序编程Erlang并发编程Erlang分布式编程YawsErlang/OTP 日期              变更说明 2014-12-21 A Outline, 1 A ...

  8. cocos2d Slider 透明滑动部件无法生成解决办法

    用cocos studio 2.3.2 制作声音大小控制滑条的时候遇到了一个奇葩bug我把透明图片和其它资源打包到合图里面然后到到cocos stdudio里面 那张透明图片变成了只有一个像素的点,最 ...

  9. apktool反编译apk文件

    1.首先下载apktool文件,可以从我的网盘下载:http://pan.baidu.com/s/1nvPdbVb 2.将你的apk文件和apktool文件放到一个文件夹下,这里就放到D:\study ...

  10. Codeforces Round #159 (Div. 2)

    A. Sockets 当插口数不够时,显然找最大\(a_i\)进行扩展. B. Playing Cubes 枚举起始颜色,Petya会尽可能相同颜色,Vasya则相反. C. View Angle 极 ...