iperf3实践
The basic commands are the same for iperf and iperf3:
Server: | |
iperf/iperf3 -s | Start server on the default port |
iperf -s -w 32M -D / iperf3 -s -D | Start server with larger TCP window, and in daemon mode |
iperf -i1 -u -s -p 5003 / iperf3 -s -p 5003 | Start UDP server on port 5003, and give 1 sec interval reports |
Client | |
iperf/iperf3 -c remotehost -i 1 -t 30 | Run a 30 second tests, giving results every 1 second |
iperff/iperf3 -c remotehost -i 1 -t 20 -r | Run a test from remotehost to localhost |
iperf/iperf3 -c remotehost -i 1 -t 20 -w 32M -P 4 | Run a test with 4 parallel streams, and with a 32M TCP buffer |
iperf/iperf3 -c remotehost -u -i 1 -b 200M | Run a 200 Mbps UDP test |
iperf3 adds a number of additional features. For example, the -i mode now reports TCP retransmit info (and is on by default), and the verbose mode now gives a lot of useful information on CPU usage, etc. Other new options include:
Client: | |
iperf3 -c remotehost -i.5 -0 2 | Run the test for 2 seconds before collecting results, to allow for TCP slowstart to finish. (Omit mode) |
iperf3 -Z -c remotehost | Use the sendfile() system call for "Zero Copy" mode. This uses much less CPU. |
iperf3 -c 192.168.12.12 -T s1 & iperf3 -c 192.168.12.13 -T s2 | Run tests to multiple interfaces at once, and label the lines to indicate which test is which |
iperf3 -c remotehost -J | Output the results in JSON format for easy parsing. |
iperf3 -A 4,4 -c remotehost | Set the CPU affinity for the sender,receiver (cores are numbered from 0). This has the same affect as doing 'numactl -C 4 iperf3'. |
iperf3 -c 10.20.1.20 -A2,2 -T "1" & ; iperf3 -c 10.20.1.20 -p 5400 -A3,3 -T "2" & |
Run 2 streams on 2 different cores, and label each using the "-T" flag. |
iperf3 thread model
In order to keep the code as simple and maintainable as possible, iperf3 is single threaded. This means that that you may be CPU-bound on some hosts, or on 40G/100G NICs. To run parallel stream iperf3 on mutiple cores, use the method shown in the table above.
实践:
[root@CentOS7 iperf-3.1.2]# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.56.106, port 58465
[ 5] local 192.168.56.103 port 5201 connected to 192.168.56.106 port 58466
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 49.9 MBytes 418 Mbits/sec
[ 5] 1.00-2.00 sec 175 MBytes 1.47 Gbits/sec
[ 5] 2.00-3.00 sec 148 MBytes 1.25 Gbits/sec
[ 5] 3.00-4.00 sec 164 MBytes 1.38 Gbits/sec
[ 5] 4.00-5.00 sec 234 MBytes 1.96 Gbits/sec
[ 5] 5.00-6.00 sec 227 MBytes 1.91 Gbits/sec
[ 5] 6.00-7.00 sec 222 MBytes 1.86 Gbits/sec
[ 5] 7.00-8.00 sec 169 MBytes 1.42 Gbits/sec
[ 5] 8.00-9.00 sec 143 MBytes 1.20 Gbits/sec
[ 5] 9.00-10.00 sec 226 MBytes 1.90 Gbits/sec
[ 5] 10.00-11.00 sec 189 MBytes 1.58 Gbits/sec
[ 5] 11.00-12.00 sec 101 MBytes 850 Mbits/sec
[ 5] 12.00-13.00 sec 188 MBytes 1.58 Gbits/sec
[ 5] 13.00-14.00 sec 207 MBytes 1.74 Gbits/sec
[ 5] 14.00-15.00 sec 215 MBytes 1.81 Gbits/sec
[ 5] 15.00-16.00 sec 218 MBytes 1.83 Gbits/sec
[ 5] 16.00-17.00 sec 217 MBytes 1.82 Gbits/sec
[ 5] 17.00-18.00 sec 217 MBytes 1.82 Gbits/sec
[ 5] 18.00-19.00 sec 169 MBytes 1.42 Gbits/sec
[ 5] 19.00-20.00 sec 230 MBytes 1.93 Gbits/sec
[ 5] 20.00-21.00 sec 228 MBytes 1.91 Gbits/sec
[ 5] 21.00-22.00 sec 220 MBytes 1.85 Gbits/sec
[ 5] 22.00-23.00 sec 227 MBytes 1.91 Gbits/sec
[ 5] 23.00-24.00 sec 231 MBytes 1.94 Gbits/sec
[ 5] 24.00-25.00 sec 232 MBytes 1.95 Gbits/sec
[ 5] 25.00-26.00 sec 146 MBytes 1.23 Gbits/sec
[ 5] 26.00-27.00 sec 200 MBytes 1.67 Gbits/sec
[ 5] 27.00-28.00 sec 180 MBytes 1.51 Gbits/sec
[ 5] 28.00-29.00 sec 176 MBytes 1.47 Gbits/sec
[ 5] 29.00-30.00 sec 170 MBytes 1.43 Gbits/sec
[ 5] 30.00-31.00 sec 217 MBytes 1.82 Gbits/sec
[ 5] 31.00-32.00 sec 215 MBytes 1.80 Gbits/sec
[ 5] 32.00-32.54 sec 116 MBytes 1.79 Gbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-32.54 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-32.54 sec 6.12 GBytes 1.62 Gbits/sec receiver
FAQ:
Deprecated flags (currently no plans to support):
-d, --dualtest Do a bidirectional test simultaneously
-r, --tradeoff Do a bidirectional test individually
-T, --ttl time-to-live, for multicast (default 1)
-x, --reportexclude [CDMSV] exclude C(connection) D(data) M(multicast)
S(settings) V(server) reports
-y, --reportstyle C report as a Comma-Separated Values