運維工具之qperf

  qperf一種測試兩個節點之間的帶寬和延遲的一款工具。它可以工作在TCP/IP或者是RDMA之上。通常,一臺作爲服務器端只要開啓qperf就可以,另一臺作爲客戶端,在客戶端進行帶寬、延遲、CPU利用率等信息的測試。


通過命令我們可以看到除了tcp、udp外,還可以測試rdma, udp, sctp等網絡協議的帶寬和延遲

# 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
    xrc_bi_bw               XRC streaming two way bandwidth
    xrc_bw                  XRC streaming one way bandwidth
    xrc_lat                 XRC 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


接下來我們看一下qperf提供的一些例子,myserver就只作爲服務器端節點的IP

#     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


通過上面的例子我們要熟悉一些參數:

  1. -t 這個參數指定測試維持的時間長度

  2. -oo 通過man查看它的用法是"-oo Var:Init:Last:Incr" Var就是參數,Init就是初始值,Last就只最大值,Incr就是增長數,*2意思是兩倍增長,2則是每次加上2字節。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章