您的位置主页 > 系统管理

网络性能测试之netperf的安装使用

[root@server2 opt]#wget ftp://ftp.netperf.org/netperf/netperf-2.4.5.tar.gz
[root@server2 opt]# tar xzvf netperf-2.4.5.tar.gz
[root@server2 opt]# cd netperf-2.4.5
[root@server2 netperf-2.4.5]# ./configure
[root@server2 netperf-2.4.5]# make && make install
按照以上方法分别在两台linux服务器上安装;
分为服务端和客户端
服务端启动如下:
[root@server2 opt]#netserver
Starting netserver at port 12865
Starting netserver at hostname 0.0.0.0 port 12865 and family AF_UNSPEC

[root@server2 opt]#
在客户端使用如下命令测试

[root@server1 etc]# netperf -H 10.10.10.131 -l 60
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.10.10.131 (10.10.10.131) port 0 AF_INET
Recv   Send    Send                          
Socket Socket  Message  Elapsed              
Size   Size    Size     Time     Throughput  
bytes  bytes   bytes    secs.    10^6bits/sec  

 87380  16384  16384    60.01     291.03      吞吐量为291.03Mb/s
[root@server1 etc]# netperf -H 10.10.10.131
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.10.10.131 (10.10.10.131) port 0 AF_INET
Recv   Send    Send                          
Socket Socket  Message  Elapsed              
Size   Size    Size     Time     Throughput  
bytes  bytes   bytes    secs.    10^6bits/sec  

 87380  16384  16384    10.00     289.18   
[root@server1 etc]# netperf -H 10.10.10.131 -c
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.10.10.131 (10.10.10.131) port 0 AF_INET
Recv   Send    Send                          Utilization       Service Demand
Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
Size   Size    Size     Time     Throughput  local    remote   local   remote
bytes  bytes   bytes    secs.    10^6bits/s  % S      % U      us/KB   us/KB

 87380  16384  16384    10.00       294.17   99.60    -1.00    27.737  -1.000
[root@server1 etc]# netperf -H 10.10.10.131 -C
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.10.10.131 (10.10.10.131) port 0 AF_INET
Recv   Send    Send                          Utilization       Service Demand
Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
Size   Size    Size     Time     Throughput  local    remote   local   remote
bytes  bytes   bytes    secs.    10^6bits/s  % U      % S      us/KB   us/KB

 87380  16384  16384    10.00       261.73   -1.00    78.08    -1.000  24.438

[root@server1 etc]# netperf --help

Usage: netperf [global options] -- [test options]

Global options:
    -a send,recv      Set the local send,recv buffer alignment
    -A send,recv      Set the remote send,recv buffer alignment
    -B brandstr       Specify a string to be emitted with brief output
    -c [cpu_rate]     Report local CPU usage
    -C [cpu_rate]     Report remote CPU usage
    -d                Increase debugging output
    -D [secs,units] * Display interim results at least every secs seconds
                      using units as the initial guess for units per second
    -f G|M|K|g|m|k    Set the output units
    -F fill_file      Pre-fill buffers with data from fill_file
    -h                Display this text
    -H name|ip,fam *  Specify the target machine and/or local ip and family
    -i max,min        Specify the max and min number of iterations (15,1)
    -I lvl[,intvl]    Specify confidence level (95 or 99) (99)
                      and confidence interval in percentage (10)
    -l testlen        Specify test duration (>0 secs) (<0 bytes|trans)
    -L name|ip,fam *  Specify the local ip|name and address family
    -o send,recv      Set the local send,recv buffer offsets
    -O send,recv      Set the remote send,recv buffer offset
    -n numcpu         Set the number of processors for CPU util
    -N                Establish no control connection, do 'send' side only
    -p port,lport*    Specify netserver port number and/or local port
    -P 0|1            Don't/Do display test headers
    -r                Allow confidence to be hit on result only
    -t testname       Specify test to perform
    -T lcpu,rcpu      Request netperf/netserver be bound to local/remote cpu
    -v verbosity      Specify the verbosity level
    -W send,recv      Set the number of send,recv buffers
    -v level          Set the verbosity level (default 1, min 0)
    -V                Display the netperf version and exit

For those options taking two parms, at least one must be specified;
specifying one value without a comma will set both parms to that
value, specifying a value with a leading comma will set just the second
parm, a value with a trailing comma will set just the first. To set
each parm to unique values, specify both and separate them with a
comma.

* For these options taking two parms, specifying one value with no comma
will only set the first parms and will leave the second at the default
value. To set the second value it must be preceded with a comma or be a
comma-separated pair. This is to retain previous netperf behaviour.
[root@server1 etc]# netperf -H 10.10.10.131 -- -M 1024
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.10.10.131 (10.10.10.131) port 0 AF_INET
Recv   Send    Send                          
Socket Socket  Message  Elapsed              
Size   Size    Size     Time     Throughput  
bytes  bytes   bytes    secs.    10^6bits/sec  

 87380  16384  16384    10.21     275.12   
[root@server1 etc]# netperf -H 10.10.10.131 -- -m 1024
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.10.10.131 (10.10.10.131) port 0 AF_INET
Recv   Send    Send                          
Socket Socket  Message  Elapsed              
Size   Size    Size     Time     Throughput  
bytes  bytes   bytes    secs.    10^6bits/sec  

 87380  16384   1024    10.00     207.06   
[root@server1 etc]# netperf -t UDP_STREAM -H 10.10.10.131 -- -m 1024
UDP UNIDIRECTIONAL SEND TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.10.10.131 (10.10.10.131) port 0 AF_INET
Socket  Message  Elapsed      Messages                
Size    Size     Time         Okay Errors   Throughput
bytes   bytes    secs            #      #   10^6bits/sec

109568    1024   10.00      269057      0     220.38
109568           10.00      246213            201.67

[root@server1 etc]# netperf -t TCP_RR -H 10.10.10.131 -- -m 1024
TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.10.10.131 (10.10.10.131) port 0 AF_INET
Local /Remote
Socket Size   Request  Resp.   Elapsed  Trans.
Send   Recv   Size     Size    Time     Rate         
bytes  Bytes  bytes    bytes   secs.    per sec   

16384  87380  1        1       10.00    1531.09   
16384  87380
[root@server1 etc]# netperf -t TCP_RR -H 10.10.10.131
TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.10.10.131 (10.10.10.131) port 0 AF_INET
send_tcp_rr: data recv error: Connection reset by peer
[root@server1 etc]# netperf -t TCP_RR -H 10.10.10.131 -- -m 10000
TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.10.10.131 (10.10.10.131) port 0 AF_INET
Local /Remote
Socket Size   Request  Resp.   Elapsed  Trans.
Send   Recv   Size     Size    Time     Rate         
bytes  Bytes  bytes    bytes   secs.    per sec   

16384  87380  1        1       10.00    1526.16   
16384  87380
[root@server1 etc]# netperf -t UDP_RR -H 10.10.10.131 -- -m 10000
UDP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.10.10.131 (10.10.10.131) port 0 AF_INET
Local /Remote
Socket Size   Request  Resp.   Elapsed  Trans.
Send   Recv   Size     Size    Time     Rate         
bytes  Bytes  bytes    bytes   secs.    per sec   

109568 109568 1        1       10.00    1598.88   
109568 109568
[root@server1 etc]#

本文出自 &ldquo改造人” 博客,请务必保留此出处http://gaizaoren.blog.51cto.com/622250/184889