Linux 网络性能测试工具 netperf 使用介绍

发布时间: 更新时间: 总字数:735 阅读时间:2m 作者: 分享 复制网址
专栏文章
  1. 网络相关测试工具汇总
  2. Linux 网络测速工具 iperf3 使用介绍
  3. Linux 网络性能测试工具 qperf 使用介绍
  4. Linux 网络性能测试工具 netperf 使用介绍(当前)

本文主要介绍 netperf 的安装、使用。Netperf是一种网络性能测试工具,主要针对 TCPUDP 的传输测试,可以指定 UDP 包的大小。

安装

https://github.com/HewlettPackard/netperf 下载

# 解压
tar -xvf netperf-netperf-2.7.0.tar.gz
cd netperf-netperf-2.7.0

# 安装
./configure && make && make install

使用

服务器端

  • help
$ netserver --help
netserver: invalid option -- '-'

Usage: netserver [options]

Options:
    -h                Display this text
    -D                Do not daemonize
    -d                Increase debugging output
    -f                Do not spawn chilren for each test, run serially
    -L name,family    Use name to pick listen address and family for family
    -N                No debugging output, even if netperf asks
    -p portnum        Listen for connect requests on portnum.
    -4                Do IPv4
    -6                Do IPv6
    -v verbosity      Specify the verbosity level
    -V                Display version information and exit
    -Z passphrase     Expect passphrase as the first thing received
  • 启动服务
$ netserver  # 启动服务
$ sar -n DEV 2  # 检测pps

客户端

  • help
$ netperf --help
netperf: invalid option -- '-'

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 time,[units] * Display interim results at least every time interval
                      using units as the initial guess for units per second
                      A negative value for time will make heavy use of the
                      system's timestamping functionality
    -f G|M|K|g|m|k    Set the output units
    -F lfill[,rfill]* Pre-fill buffers with data from specified 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)
    -j                Keep additional timing statistics
    -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
    -s seconds        Wait seconds between test setup and test start
    -S                Set SO_KEEPALIVE on the data connection
    -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
    -y local,remote   Set the socket priority
    -Y local,remote   Set the IP_TOS. Use hexadecimal.
    -Z passphrase     Set and pass to netserver a passphrase

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.
  • 测试
netperf -H <server ip> -4 -l 60 -n 4 -t [TCP_STREAM/UDP_STREAM] -- -m [64/128/256]

说明:

  • -H 服务端地址
  • -4 IPV4协议
  • -l 测试时长
  • -n 设置CPU util的处理器数量,配置机器CPU数量
  • -t 测试类型,TCP_STREAM/UDP_STREAM等
  • -m 指定报的大小
专栏文章
  1. 网络相关测试工具汇总
  2. Linux 网络测速工具 iperf3 使用介绍
  3. Linux 网络性能测试工具 qperf 使用介绍
  4. Linux 网络性能测试工具 netperf 使用介绍(当前)
最新评论
加载中...
Home Archives Categories Tags Statistics