iperf3實踐

来源:http://www.cnblogs.com/dongdongwq/archive/2016/04/15/5394113.html
-Advertisement-
Play Games

The basic commands are the same for iperf and iperf3: iperf3 adds a number of additional features. For example, the -i mode now reports TCP retransmit ...


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 for TCP 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

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 1 簡述一下泛型,並描述一下你應用過的場景 定義: 泛型是程式設計語言的一種特性。允許程式員在強類型程式設計語言中編寫代碼時定義一些可變部分,那些部分在使用前必須作出指明。將類型參數化以達到代碼復用提高軟體開發工作效率的一種數據類型。泛型的主要思想是將演算法與數據結構完全分離,使定義的演算法能作用於多種 ...
  • 在看後面的內容之前,請先猜猜上面四個Console.WriteLine()的輸出結果都是什麼? 第一個,沒什麼好說的,各種教材上都說爛了。值類型作為參數傳遞的時候編輯的是它的副本。 第二個,有的人會答”321″,其實不是這樣的。我們先往後看。 第三個,和第四個比較容易混淆。第三個是對傳參傳進來的對象 ...
  • 文件比較運算符-e filename 如果 filename存在,則為真 [ -e /var/log/syslog ]-d filename 如果 filename為目錄,則為真 [ -d /tmp/mydir ]-f filename 如果 filename為常規文件,則為真 [ -f /usr/ ...
  • 參數解析: -j:使用-j才能使用-f -n:預設情況下,如果定時進程正在運行,date命令會在本地組的所有機器設置時間。 -n選項可以禁止這種行為,表示只設置當前電腦。 -u:顯示或設置日期為UTC時間。 -d:設置內核的時區,一般不用 -r:秒轉換時間 -t:(time zone)設置一GMT ...
  • 介紹 變數是shell腳本中必不可少的組成部分,在腳本中使用變數不需要提前聲明。在bash中每一個變數都是字元串,所以在變數賦值時候不管有沒有使用引號都是以字元串的形式存儲,但是如果值中存在特殊字元就需要用引號將值進行引用, 在bash中可以使用單引號或者雙引號。 環境:centos 6.7 賦值 ...
  • 1.掛載光碟命令 mount : mount [-t vfstype] [-o options] device dir mount [-t 文件系統] [-o 特殊選項] 設備文件名 掛載點 -t 指定掛載的文件系統類型,ext3,ext4,iso9660(光碟的文件類型)f等類型 -o 指定額外的 ...
  • zabbix3.0安裝註意: 1、PHP要5.4版本以上 2、防火牆關閉 3、selinux關閉 操作步驟 一、安裝PHP 添加 epel 源 # rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6- ...
  • cmd視窗中:C:\>netstat -aon|findstr "8080"TCP 127.0.0.1:9050 0.0.0.0:0 LISTENING 2016 //本機埠被進程號為2016的進程占用。C:\>tasklist|findstr "2016"demo.exe 2016 Consol ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...