zoukankan      html  css  js  c++  java
  • iperf 一个测试网络吞吐的工具

    在分布式文件系统开发和测试过程中,我们经常需要测试真实的网络带宽,来进行估测分布式系统的传输性能,所以我们要对现有的网络进行测试;Iperf 是一个网络性能测试工具。IPerf可以测试最大的TCP和UDP带宽性能。Iperf具有多种参数和特性,可以根据需要调整。IPerf可以报告带宽。延迟抖动和数据包丢失。下面就对iperf 软件的功能和用法进行简单的介绍:

    官方网站:

    https://iperf.fr/  (iperf 3)

    http://sourceforge.net/projects/iperf2 

    http://github.com/esnet/iperf 

    具体的两个不同,网站进行了解;

    在ubuntu或者fedora 中,可以使用 apt或者yum 来进行搜索安装;

    具体用法:

    具体的使用 可以使用 man iperf 命令来进行安装;

    常用测试选项:(iperf2 和 iperf3 稍有不同)

    • -i  设置iperf输出结果的时间间隔
    • -m  在结果中显示TCP的MSS大小
    • -u  使用UDP协议
    • -M  设置TCP的MSS大小
    • -s  以server模式运行
    • -c  以client模式运行
    • -t  设置iperf测试时间
    • -n  设置iperf测试时发送的数据量,与‘-t’参数二选一
    • -P  并行运行的线程数,默认为1
    • -b  设置测试时的发送带宽
    • -w  TCP协议时设置TCP window的大小,UDP协议时设置接收缓冲大小

    测试例子:

    root@buaa-3:~# iperf -u -s -p 80 

    测试 80端口 udp 接收情况;

    [root@docker ~]# iperf -c 192.168.10.14 -u -p 80 -e -i 1 

    连接 80端口进行测试 并以1秒为间隔输出;

    iperf 既可以用于网络带宽测试也可以用来进行端口测试。更多的使用范例,大家可以在网上查找。这里我只是简单记录,用于备忘。

    保持更新,转载请注明出处。cnblogs/xuyaowen 

    iperf 参考文献:https://iperf.fr/iperf-doc.php 

    iperf 3 使用说明:

    ➜  ~ iperf3 -h
    Usage: iperf3 [-s|-c host] [options]
           iperf3 [-h|--help] [-v|--version]
    
    Server or Client:
      -p, --port      #         server port to listen on/connect to
      -f, --format   [kmgtKMGT] format to report: Kbits, Mbits, Gbits, Tbits
      -i, --interval  #         seconds between periodic throughput reports
      -F, --file name           xmit/recv the specified file
      -B, --bind      <host>    bind to the interface associated with the address <host>
      -V, --verbose             more detailed output
      -J, --json                output in JSON format
      --logfile f               send output to a log file
      --forceflush              force flushing output at every interval
      -d, --debug               emit debugging output
      -v, --version             show version information and quit
      -h, --help                show this message and quit
    Server specific:
      -s, --server              run in server mode
      -D, --daemon              run the server as a daemon
      -I, --pidfile file        write PID file
      -1, --one-off             handle one client connection then exit
      --rsa-private-key-path    path to the RSA private key used to decrypt
                                authentication credentials
      --authorized-users-path   path to the configuration file containing user
                                credentials
    Client specific:
      -c, --client    <host>    run in client mode, connecting to <host>
      -u, --udp                 use UDP rather than TCP
      --connect-timeout #       timeout for control connection setup (ms)
      -b, --bitrate #[KMG][/#]  target bitrate in bits/sec (0 for unlimited)
                                (default 1 Mbit/sec for UDP, unlimited for TCP)
                                (optional slash and packet count for burst mode)
      --pacing-timer #[KMG]     set the timing for pacing, in microseconds (default 1000)
      -t, --time      #         time in seconds to transmit for (default 10 secs)
      -n, --bytes     #[KMG]    number of bytes to transmit (instead of -t)
      -k, --blockcount #[KMG]   number of blocks (packets) to transmit (instead of -t or -n)
      -l, --length    #[KMG]    length of buffer to read or write
                                (default 128 KB for TCP, dynamic or 1460 for UDP)
      --cport         <port>    bind to a specific client port (TCP and UDP, default: ephemeral port)
      -P, --parallel  #         number of parallel client streams to run
      -R, --reverse             run in reverse mode (server sends, client receives)
      --bidir                   run in bidirectional mode.
                                Client and server send and receive data.
      -w, --window    #[KMG]    set window size / socket buffer size
      -M, --set-mss   #         set TCP/SCTP maximum segment size (MTU - 40 bytes)
      -N, --no-delay            set TCP/SCTP no delay, disabling Nagle's Algorithm
      -4, --version4            only use IPv4
      -6, --version6            only use IPv6
      -S, --tos N               set the IP type of service, 0-255.
                                The usual prefixes for octal and hex can be used,
                                i.e. 52, 064 and 0x34 all specify the same value.
      --dscp N or --dscp val    set the IP dscp value, either 0-63 or symbolic.
                                Numeric values can be specified in decimal,
                                octal and hex (see --tos above).
      -Z, --zerocopy            use a 'zero copy' method of sending data
      -O, --omit N              omit the first n seconds
      -T, --title str           prefix every output line with this string
      --extra-data str          data string to include in client and server JSON
      --get-server-output       get results from server
      --udp-counters-64bit      use 64-bit counters in UDP test packets
      --repeating-payload       use repeating pattern in payload, instead of
                                randomized payload (like in iperf2)
      --username                username for authentication
      --rsa-public-key-path     path to the RSA public key used to encrypt
                                authentication credentials
    
    [KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-
  • 相关阅读:
    [LeetCode] Letter Combinations of a Phone Number
    [LeetCode] Combinations
    [Algorithms] Longest Increasing Subsequence
    2.Orange安装
    1.Orange是什么鬼?
    5.motan之注解方式配置
    4.motan之集群调用
    3.motan之异步调用
    2、motan入门程序
    1、微博RPC框架Motan
  • 原文地址:https://www.cnblogs.com/xuyaowen/p/iperf-for-network.html
Copyright © 2011-2022 走看看