ablog

不器用で落着きのない技術者のメモ

iperf でパケットサイズを指定する

iperf でパケットサイズを変更する。-l オプションで指定できる。

$ iperf3 -c 172.**.**.36 -P 48 -t 1800 -i 60 -l 1

CloudWatch メトリクス

  • クラアント

f:id:yohei-a:20201206160853p:plain

  • サーバ

f:id:yohei-a:20201206150258p:plain
f:id:yohei-a:20201206170329p:plain

OS性能メトリクス

  • sar で PPS を確認。
    • rxpck/s: 受信パケット数/秒
    • txpck/s: 送信パケット数/秒
[ec2-user@ip-172-**-**-36 ~]$  sar -n DEV 5
Linux 4.14.203-156.332.amzn2.x86_64 (ip-172-**-**-36.ap-northeast-1.compute.internal) 	12/06/20 	_x86_64_	(48 CPU)

(中略)

05:53:14        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
05:53:19         eth0  82989.2082308.606295.53   5308.89      0.00      0.00      0.00
05:53:19           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00

05:53:19        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
05:53:24         eth0  83873.40  83421.00   6356.34   5380.59      0.00      0.00      0.00
05:53:24           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00

05:53:24        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
05:53:29         eth0  84660.40  84219.00   6405.38   5432.81      0.00      0.00      0.00
05:53:29           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
^C


05:53:29        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
05:53:30         eth0  84517.60  84097.60   6385.90   5423.66      0.00      0.00      0.00
05:53:30           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00

Average:        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
Average:         eth0  83774.18  83277.16   6349.22   5371.52      0.00      0.00      0.00
Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
[ec2-user@ip-172-**-**-36 ~]$
  • mpstat
[ec2-user@ip-172-**-**-36 ~]$ mpstat -P ALL 5
(中略)
Average:     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
Average:     all    0.61    0.00    1.38    0.00    0.00    0.11    0.00    0.00    0.00   97.90
Average:       0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
(中略)
Average:      45    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
Average:      46   29.11    0.00   65.69    0.00    0.00    5.20    0.00    0.00    0.00    0.00 ★
Average:      47    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
#  echo "f" > /sys/class/net/eth0/queues/rx-0/rps_cpus
#  echo 4096 > /sys/class/net/eth0/queues/rx-0/rps_flow_cnt
#  echo 32768 > /proc/sys/net/core/rps_sock_flow_entries
[ec2-user@ip-172-**-**-36 ~]$ mpstat -P ALL 5
(中略)

07:20:05     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
07:20:10     all    0.65    0.00    1.39    0.00    0.00    0.07    0.00    0.00    0.00   97.89
07:20:10       0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
(中略)
07:20:10      28    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
07:20:10      29   31.00    0.00   66.00    0.00    0.00    3.00    0.00    0.00    0.00    0.00 ★
07:20:10      30    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
(中略)
07:20:10      47    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
^C

環境

[ec2-user@ip-172-**-**-36 ~]$ cat /etc/system-release
Amazon Linux release 2 (Karoo)
[ec2-user@ip-172-**-**-36 ~]$ uname -r
4.14.203-156.332.amzn2.x86_64
  • バージョン
$ iperf3 -v
iperf 3.9+ (cJSON 1.7.13)
Linux ip-172-31-16-36.ap-northeast-1.compute.internal 4.14.203-156.332.amzn2.x86_64 #1 SMP Fri Oct 30 19:19:33 UTC 2020 x86_64
Optional features available: CPU affinity setting, IPv6 flow label, TCP congestion algorithm setting, sendfile / zerocopy, socket pacing||<
  • ヘルプ
$ 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
  -A, --affinity n/n,m      set CPU affinity
  -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
  --timestamps<=format>     emit a timestamp at the start of each output line
                            (optional "=" and format string as per strftime(3))
  -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
  --server-bitrate-limit #[KMG][/#]   server's total bit rate limit (default 0 = no limit)
                            (optional slash and number of secs interval for averaging
                            total data rate.  Default is 5 seconds)
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)
  --fq-rate #[KMG]          enable fair-queuing based socket pacing in
                            bits/sec (Linux only)
  -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
  -C, --congestion <algo>   set TCP congestion control algorithm (Linux and FreeBSD only)
  -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).
  -L, --flowlabel N         set the IPv6 flow label (only supported on Linux)
  -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)

[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-

iperf3 homepage at: https://software.es.net/iperf/
Report bugs to:     https://github.com/esnet/iperf