1. 程式人生 > >用qperf測網路頻寬和延遲

用qperf測網路頻寬和延遲

2012-07-05

http://abloz.com date:2012.7.5

yufeng的blog談到qperf來測試網路頻寬和延遲,試用了一下,感覺不錯。

Hadoop47當伺服器

[[email protected] ~]$ sudo yum install qperf
[[email protected] ~]$ qperf

Hadoop48當客戶端

[[email protected] ~]$ sudo yum install qperf

[[email protected] ~]$ qperf Hadoop47 tcp_bw tcp_lat
tcp_bw:
    bw  =  115 MB/sec
tcp_lat:
    latency  =  93.3 us

內網虛擬機器,頻寬115MB和延遲93us,正常範圍。

再測試一下發包從1個位元組到64k個位元組,每次翻倍的資料。–loop表示迴圈:

[[email protected] ~]$ qperf Hadoop47 --loop msg_size:1:64K:*2 tcp_bw tcp_lat
tcp_bw:
    bw  =  5.38 MB/sec
tcp_bw:
    bw  =  10.5 MB/sec
tcp_bw:
    bw  =  20.1 MB/sec
tcp_bw:
    bw  =  40.4 MB/sec
tcp_bw:
    bw  =  76.8 MB/sec
tcp_bw:
    bw  =  115 MB/sec
tcp_bw:
    bw  =  116 MB/sec
tcp_bw:
    bw  =  116 MB/sec
tcp_bw:
    bw  =  115 MB/sec
tcp_bw:
    bw  =  116 MB/sec
tcp_bw:
    bw  =  115 MB/sec
tcp_bw:
    bw  =  115 MB/sec
tcp_bw:
    bw  =  115 MB/sec
tcp_bw:
    bw  =  115 MB/sec
tcp_bw:
    bw  =  115 MB/sec
tcp_bw:
    bw  =  115 MB/sec
tcp_bw:
    bw  =  116 MB/sec

tcp_lat:
    latency  =  94 us
tcp_lat:
    latency  =  96 us
tcp_lat:
    latency  =  96.1 us
tcp_lat:
    latency  =  93.5 us
tcp_lat:
    latency  =  95.1 us
tcp_lat:
    latency  =  98.7 us
tcp_lat:
    latency  =  97.7 us
tcp_lat:
    latency  =  95 us
tcp_lat:
    latency  =  99.2 us
tcp_lat:
    latency  =  106 us
tcp_lat:
    latency  =  120 us
tcp_lat:
    latency  =  146 us
tcp_lat:
    latency  =  157 us
tcp_lat:
    latency  =  204 us
tcp_lat:
    latency  =  299 us
tcp_lat:
    latency  =  436 us
tcp_lat:
    latency  =  724 us

可見每個包32位元組基本頻寬趨近最大,延遲資料在包達到8k以上,延遲變得較大,達204us。

該工具還可以測試udp,指定埠,設定mtu大小等,功能強大。下面是其自帶示例:

[[email protected] ~]$ 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

如非註明轉載, 均為原創. 本站遵循知識共享CC協議,轉載請註明來源