Linux command – qperf

Loading

之前介紹過 Linux 環境下的網路效能測試工具 iperf 但老實說他是一個很陽春的測試工具,在 RHEL6 的版本新增加了 qperf 為預設的網路效能測試工具,如果不是使用 RHEL6 在 rpmfind 都可以找到 rpm 檔案.

好,我們來看看 qperf 要如何使用!! 如下圖 qperf 採用的方式如同 iperf 的 Server / Client 模式進行量測.測試環境如下:
qperf01
我們可以直接透過 qperf –help examples 來看,最常使用的網路效能測試參數.

[root@benjr ~]# qperf –help examples
In these examples, we first run qperf on a node called myserver in server
mode by invoking it with no arguments. In all the subsequent examples, we
run qperf on another node and connect to the server which we assume has a
hostname of myserver.
* To run a TCP bandwidth and latency test:
qperf myserver tcp_bw tcp_lat
* To run a SDP bandwidth test for 10 seconds:
qperf myserver -t 10 sdp_bw
* To run a UDP latency test and then cause the server to terminate:
qperf myserver udp_lat quit
* To measure the RDMA UD latency and bandwidth:
qperf myserver ud_lat ud_bw
* To measure RDMA UC bi-directional bandwidth:
qperf myserver rc_bi_bw
* To get a range of TCP latencies with a message size from 1 to 64K
qperf myserver -oo msg_size:1:64K:*2 -vu tcp_lat

要知道詳細的參數使用,直接用 qperf –help tests 就可以得知.

root@benjr ~]# qperf –help tests
Miscellaneous
conf Show configuration
quit Cause the server to quit
Socket Based
rds_bw RDS streaming one way bandwidth
rds_lat RDS one way latency
sctp_bw SCTP streaming one way bandwidth
sctp_lat SCTP one way latency
sdp_bw SDP streaming one way bandwidth
sdp_lat SDP one way latency
tcp_bw TCP streaming one way bandwidth
tcp_lat TCP one way latency
udp_bw UDP streaming one way bandwidth
udp_lat UDP one way latency
RDMA Send/Receive
rc_bi_bw RC streaming two way bandwidth
rc_bw RC streaming one way bandwidth
rc_lat RC one way latency
uc_bi_bw UC streaming two way bandwidth
uc_bw UC streaming one way bandwidth
uc_lat UC one way latency
ud_bi_bw UD streaming two way bandwidth
ud_bw UD streaming one way bandwidth
ud_lat UD one way latency
RDMA
rc_rdma_read_bw RC RDMA read streaming one way bandwidth
rc_rdma_read_lat RC RDMA read one way latency
rc_rdma_write_bw RC RDMA write streaming one way bandwidth
rc_rdma_write_lat RC RDMA write one way latency
rc_rdma_write_poll_lat RC RDMA write one way polling latency
uc_rdma_write_bw UC RDMA write streaming one way bandwidth
uc_rdma_write_lat UC RDMA write one way latency
uc_rdma_write_poll_lat UC RDMA write one way polling latency
InfiniBand Atomics
rc_compare_swap_mr RC compare and swap messaging rate
rc_fetch_add_mr RC fetch and add messaging rate
Verification
ver_rc_compare_swap Verify RC compare and swap
ver_rc_fetch_add Verify RC fetch and add

其中一台當做 server 直接執行 qperf 即可.

[root@benjr ~]# qperf 

另外一台當做 Client 需要使用參數

[root@benjr ~]# qperf 172.16.0.51 tcp_bw tcp_lat conf
tcp_bw:
bw = 117 MB/sec
tcp_lat:
latency = 44.2 us
conf:
loc_node = localhost.localdomain
loc_cpu = 16 Cores: Intel Xeon X5667 @ 3.07GHz
loc_os = Linux 2.6.32-279.el6.x86_64
loc_qperf = 0.4.6
rem_node = localhost.localdomain
rem_cpu = 16 Cores: Intel Xeon E5520 @ 2.27GHz
rem_os = Linux 2.6.32-279.el6.x86_64
rem_qperf = 0.4.6
  • tcp_bw
    TCP 頻寬 bandwidth,以 Byte 為單位
  • tcp_lat
    TCP 的延遲 latency 時間
  • conf
    顯示系統的組態

qperf 除了一般的網路測試外,支援了 RDMA (Remote Direct Memory Access 遠程直接數據存取技術) 以及 InfiniBand 等特殊網路技術.

下面的例子使用了 -oo msg_size:1:64k:*2 參數

[root@benjr ~]# qperf -oo msg_size:1:64k:*2 172.16.0.51 tcp_bw tcp_lat
tcp_bw:
bw = 1.4 MB/sec
tcp_bw:
bw = 2.69 MB/sec
tcp_bw:
bw = 4.55 MB/sec
tcp_bw:
bw = 7.87 MB/sec
tcp_bw:
bw = 19.4 MB/sec
tcp_bw:
bw = 35.6 MB/sec
tcp_bw:
bw = 57.3 MB/sec
tcp_bw:
bw = 91.9 MB/sec
tcp_bw:
bw = 118 MB/sec
tcp_bw:
bw = 117 MB/sec
tcp_bw:
bw = 116 MB/sec
tcp_bw:
bw = 118 MB/sec
tcp_bw:
bw = 116 MB/sec
tcp_bw:
bw = 116 MB/sec
tcp_bw:
bw = 116 MB/sec
tcp_bw:
bw = 117 MB/sec
tcp_lat:
latency = 44.4 us
tcp_lat:
latency = 43.2 us
tcp_lat:
latency = 44.5 us
tcp_lat:
latency = 43.3 us
tcp_lat:
latency = 44.3 us
tcp_lat:
latency = 44.5 us
tcp_lat:
latency = 47.2 us
tcp_lat:
latency = 49.2 us
tcp_lat:
latency = 55 us
tcp_lat:
latency = 63.4 us
tcp_lat:
latency = 83.6 us
tcp_lat:
latency = 143 us
tcp_lat:
latency = 248 us
tcp_lat:
latency = 264 us
tcp_lat:
latency = 348 us
tcp_lat:
latency = 556 us

當我們需要測試多種 message size 時就可以直接使用這個參數  -oo msg_size:1:64k:*2 ,他會將 message size 從 1 以2 的幕次(1,2,4,8,16,32,64,128…)一直加到 64K 為止.

沒有解決問題,試試搜尋本站其他內容

4 thoughts on “Linux command – qperf

  1. 你好,我想請教一下,為什麼我用iperf測試頻寬,得到了94.3 MB/sec(我的hub是10/100MB) ,但是用qperf打卻只能得到11.7 MB/sec
    這兩者在做頻寬的測試有何不同呢?

  2. 如果是 Ubuntu 的話,須要自行安裝.最新版本請自行上網站查詢 https://www.openfabrics.org/downloads/qperf/

    root@benjr:~# wget https://www.openfabrics.org/downloads/qperf/qperf-0.4.9.tar.gz
    root@benjr:~# tar zxvf qperf-0.4.9.tar.gz
    root@benjr:~# cd qperf-0.4.9
    

    開始安裝

    root@benjr:~/qperf-0.4.9 # ./cleanup
    root@benjr:~/qperf-0.4.9 # ./autogen.sh
    + [ -e NEWS ]
    + touch NEWS
    + [ -e README ]
    + [ -e ChangeLog ]
    + touch ChangeLog
    + aclocal
    ./autogen.sh: 7: ./autogen.sh: aclocal: not found
    

    缺少套件安裝一下就可以用了

    root@benjr:~/qperf-0.4.9 # apt-get install automake
    root@benjr:~/qperf-0.4.9 # ./autogen.sh
    root@benjr:~/qperf-0.4.9 # ./configure
    root@benjr:~/qperf-0.4.9 # make
    root@benjr:~/qperf-0.4.9 # make install
    

    執行方式跟前面的範例一樣.

發佈回覆給「admin」的留言 取消回覆

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料