樹莓派 3B+ 筦窺︰ GigaBit ︰ 300MBit !認識工具‧下

雖說最好一事畢後,再起一事。然而行文筆法,總得依著故事情節以及節奏,就讓我們暫將 RSSI 定向器放下,隨著 W!o^{+} 的腳步繼續趕路吧。

一時只覺或前行、或右迴旋、或左迴旋、九彎十八拐的向著出口走 。突然狂風呼嘯,沙塵滾滾橫亙眼前不遠處。這時感覺 W!o 放慢了步伐,說道︰出口快到,恰遇『無常風』,需要等風沙退後,方可急度『不歸路』,穿越『無影牆』入谷。一段嗚哩哇啦的聲音,盡講些『聽譕』的字詞。或許 W!o 早料著了,接著又講︰出口林子外接著東西向的過道,兩頭皆通大海,若是俯瞰形狀像個『沙漏』。此處最窄,風沙極強,直能將人吹落幾里外的海中。而且東西林徑交接處有兩座『石敢當』,西邊的刻著『 疾 風 』,東邊之上有『 勁 草 』。由於在地原鄉人不識古文,因傷人害命之故,將之稱之為『不歸路』。後來 M♪o 帶著學生在此作『科研調查』時,始解讀了西邊刻的是『疾風』,東邊上的為『勁草』。而且這裡的『徑邊草』,貌似『菰』

不死草

 

卻秋生春死,又嚐之酸苦,不類茭白。雖說《 典 》典裡有︰

《十洲記》:「上有不死之草,草形如菰,苗長三四尺,人已死三日者,以草覆之皆當時活也。服之令人長生。昔秦始皇大苑中,多枉死者橫道,有鳥如烏狀,銜此草覆死人面,當時起坐而自活也。有司聞奏,始皇遣使者齎草以問北郭鬼谷先生。鬼谷先生云:「臣嘗聞東海祖洲上有不死之草,生玉田中,或名為養神芝。其葉似菰 ,苗叢生,一株可活一人。」始皇於是慨然言曰,可採得否?乃使使者徐福,發童男童女五百人,率攝樓船等入海尋祖洲,遂不返。 」

,此草卻無不死之效,難道果有名叫『勁草』之草的耶?後來也許 M♪o 也自覺好笑,既是『生生』,既已『生生』,誰又該管那誰知誰不知曉的呢?不知是因設想那當年之人選址植栽,真有『憂患』乎之思,還是對目下之境『傷感』之意,隨筆也記下了︰

天若有情,天亦老,

北宋‧晏幾道 《鷓鴣天》

其一

彩袖殷勤捧玉鐘。當年拚卻醉顏紅。

舞低楊柳樓心月,歌盡桃花扇底風。

從別后,憶相逢。幾回魂夢與君同。

今宵剩把銀釭照,猶恐相逢是夢中。

其二

醉拍春衫惜舊香。天將離恨惱疏狂。

年年陌上生秋草,日日樓中到夕陽。

云渺渺,水茫茫。征人歸路許多長。

相思本是無憑語,莫向花箋費淚行!

疾風知勁草。

後有好事者得知此事,設法取得 M♪o  筆記抄本將之公開,從此此路有了個大名叫『真情小徑』,當真『疾風配勁草』的哩!!

── 《勇闖新世界︰ W!O《卡夫卡村》變形祭︰ ○ 局 □ 陣【☯】

 

『衝浪』者,追求『疾風』;『行遠』者,愛好『勁草』!

從事『科研』的人,想要清楚其間『關係』嘍?

所以創新『工具』

 

iperf3

The iperf series of tools perform active measurements to determine the maximum achievable bandwidth on IP networks. It supports tuning of various parameters related to timing, protocols, and buffers. For each test it reports the measured throughput, loss, and other parameters.

This version, sometimes referred to as iperf3, is a redesign of an original version developed at NLANR / DAST. iperf3 is a new implementation from scratch, with the goal of a smaller, simpler code base, and a library version of the functionality that can be used in other programs. iperf3 also incorporates a number of features found in other tools such as nuttcp and netperf, but were missing from the original iperf. These include, for example, a zero-copy mode and optional JSON output. Note that iperf3 is not backwards compatible with the original iperf.

Primary development for iperf3 takes place on CentOS Linux, FreeBSD, and macOS. At this time, these are the only officially supported platforms, however there have been some reports of success with OpenBSD, Android, and other Linux distributions.

iperf3 is principally developed by ESnet / Lawrence Berkeley National Laboratory. It is released under a three-clause BSD license.

iperf2 is no longer being developed by its original maintainers. However, beginning in 2014, another developer began fixing bugs and enhancing functionality, and generating releases of iperf2. Both projects (as of late 2017) are currently being developed actively, but independently. More information can be found in the iperf3 FAQ.

 

好『度量』呀◎

不知『舊聞』者,何妨『重學』乎??

Invoking iperf3

iperf3 includes a manual page listing all of the command-line options. The manual page is the most up-to-date reference to the various flags and parameters.

For sample command line usage, see:

https://fasterdata.es.net/performance-testing/network-troubleshooting-tools/iperf/

Using the default options, iperf3 is meant to show typical well designed application performance. “Typical well designed application” means avoiding artificial enhancements that work only for testing (such as splice()-ing the data to /dev/null). iperf3 does also have flags for “extreme best case” optimizations but they must be explicitly activated. These flags include the -Z (--zerocopy) and-A (--affinity) options.

iperf3 Manual Page

This section contains a plaintext rendering of the iperf3 manual page. It is presented here only for convenience; the text here might not correspond to the current version of iperf3. The authoritative iperf3 manual page is included in the source tree and installed along with the executable.

……

iperf2 / iperf3

 iperf is a simple tool to let you measure memory-to-memory performance access a network. iperf3 is a new implementation from scratch, with the goal of a smaller, simpler code base, and a library version of the functionality that can be used in other programs. iperf3 is not backwards compatible with iperf2.x. The most recent iperf3 release is always available for both Debianand RHEL-based systems from the perfSONAR repository. We recommend iperf3 over older versions iperf2 because the TCP retransmit and CWND report is very helpful for troubleshooting. iperf2.0.8 and higher now support this via the ‘-e’ flag.

On public test hosts, we recommend that pScheduler should be used to ensure only one iperf test runs at a time.

A comparison of throughput measurement tools is available here.

The basic commands are the same for iperf2 and iperf3:

SAMPLE IPERF / IPERF3 COMMANDS
Server:
iperf -s / 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. Note that for iperf3 the -u option is passed to the server from the client.
Client
iperf/iperf3 -c remotehost -i 1 -t 30 Run a 30 second tests, giving results every 1 second
iperf/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:

NEW IPERF3 COMMANDS
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 on older hardware.
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′ on both client and server.
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 is normally used to measure memory to memory performance, but you can also use iperf3 for determine if the network or the disk is the bottleneck.

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 multiple cores, use the method shown in the table above. Or use iperf2.

For more information, see the iperf3 FAQ.

 

試著解讀『親身經驗』︰

測試環境︰

GigaBit ethernet switch + CAT5e cable 。

Server︰ RPI 3B+ boot from SD card

pi@raspberrypi:~ iperf3 -s ----------------------------------------------------------- Server listening on 5201 ----------------------------------------------------------- Accepted connection from 5.168.168.5, port 39354 [  5] local 5.168.168.5 port 5201 connected to 5.168.168.5 port 39356 [ ID] Interval           Transfer     Bandwidth [  5]   0.00-1.00   sec   491 MBytes  4.12 Gbits/sec                   [  5]   1.00-2.00   sec   512 MBytes  4.29 Gbits/sec                   [  5]   2.00-3.00   sec   514 MBytes  4.31 Gbits/sec                   [  5]   3.00-4.00   sec   511 MBytes  4.29 Gbits/sec                   [  5]   4.00-5.00   sec   519 MBytes  4.36 Gbits/sec                   [  5]   5.00-6.00   sec   526 MBytes  4.41 Gbits/sec                   [  5]   6.00-7.00   sec   544 MBytes  4.56 Gbits/sec                   [  5]   7.00-8.00   sec   528 MBytes  4.43 Gbits/sec                   [  5]   8.00-9.00   sec   530 MBytes  4.45 Gbits/sec                   [  5]   9.00-10.00  sec   528 MBytes  4.43 Gbits/sec                   [  5]  10.00-10.02  sec  10.5 MBytes  4.16 Gbits/sec                   - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval           Transfer     Bandwidth [  5]   0.00-10.02  sec  0.00 Bytes  0.00 bits/sec                  sender [  5]   0.00-10.02  sec  5.09 GBytes  4.36 Gbits/sec                  receiver ----------------------------------------------------------- Server listening on 5201 ----------------------------------------------------------- Accepted connection from 5.168.168.6, port 58986 [  5] local 5.168.168.5 port 5201 connected to 5.168.168.6 port 58988 [ ID] Interval           Transfer     Bandwidth [  5]   0.00-1.00   sec  26.8 MBytes   225 Mbits/sec                   [  5]   1.00-2.00   sec  26.0 MBytes   218 Mbits/sec                   [  5]   2.00-3.00   sec  26.1 MBytes   219 Mbits/sec                   [  5]   3.00-4.00   sec  27.5 MBytes   230 Mbits/sec                   [  5]   4.00-5.00   sec  26.7 MBytes   224 Mbits/sec                   [  5]   5.00-6.00   sec  26.5 MBytes   223 Mbits/sec                   [  5]   6.00-7.00   sec  27.6 MBytes   231 Mbits/sec                   [  5]   7.00-8.00   sec  27.5 MBytes   231 Mbits/sec                   [  5]   8.00-9.00   sec  26.5 MBytes   223 Mbits/sec                   [  5]   9.00-10.00  sec  26.8 MBytes   225 Mbits/sec                   [  5]  10.00-10.04  sec   735 KBytes   160 Mbits/sec                   - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval           Transfer     Bandwidth [  5]   0.00-10.04  sec  0.00 Bytes  0.00 bits/sec                  sender [  5]   0.00-10.04  sec   269 MBytes   225 Mbits/sec                  receiver ----------------------------------------------------------- Server listening on 5201 ----------------------------------------------------------- Accepted connection from 5.168.168.17, port 40102 [  5] local 5.168.168.5 port 5201 connected to 5.168.168.17 port 40104 [ ID] Interval           Transfer     Bandwidth [  5]   0.00-1.00   sec  11.0 MBytes  92.0 Mbits/sec                   [  5]   1.00-2.00   sec  11.2 MBytes  94.1 Mbits/sec                   [  5]   2.00-3.00   sec  11.2 MBytes  94.1 Mbits/sec                   [  5]   3.00-4.00   sec  11.2 MBytes  94.1 Mbits/sec                   [  5]   4.00-5.00   sec  11.2 MBytes  94.1 Mbits/sec                   [  5]   5.00-6.00   sec  11.2 MBytes  94.1 Mbits/sec                   [  5]   6.00-7.00   sec  11.2 MBytes  94.1 Mbits/sec                   [  5]   7.00-8.00   sec  11.2 MBytes  94.1 Mbits/sec                   [  5]   8.00-9.00   sec  11.2 MBytes  94.1 Mbits/sec                   [  5]   9.00-10.00  sec  11.2 MBytes  94.1 Mbits/sec                   [  5]  10.00-10.02  sec   272 KBytes  93.6 Mbits/sec                   - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval           Transfer     Bandwidth [  5]   0.00-10.02  sec  0.00 Bytes  0.00 bits/sec                  sender [  5]   0.00-10.02  sec   112 MBytes  93.9 Mbits/sec                  receiver ----------------------------------------------------------- Server listening on 5201 ----------------------------------------------------------- </pre>    <span style="color: #008080;">‧ Local loopback</span> <pre class="lang:default decode:true">pi@raspberrypi:~ iperf3 -c 5.168.168.5 -V
iperf 3.1.3
Linux raspberrypi 4.14.70-v7+ #1144 SMP Tue Sep 18 17:34:46 BST 2018 armv7l
Time: Sat, 22 Sep 2018 08:30:57 GMT
Connecting to host 5.168.168.5, port 5201
      Cookie: raspberrypi.1537605057.293666.36e2d1
      TCP MSS: 21888 (default)
[  4] local 5.168.168.5 port 39356 connected to 5.168.168.5 port 5201
Starting Test: protocol: TCP, 1 streams, 131072 byte blocks, omitting 0 seconds, 10 second test
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec   510 MBytes  4.27 Gbits/sec    0   1.19 MBytes       
[  4]   1.00-2.00   sec   511 MBytes  4.29 Gbits/sec    0   1.19 MBytes       
[  4]   2.00-3.00   sec   514 MBytes  4.31 Gbits/sec    0   1.19 MBytes       
[  4]   3.00-4.00   sec   512 MBytes  4.29 Gbits/sec    0   1.19 MBytes       
[  4]   4.00-5.00   sec   519 MBytes  4.35 Gbits/sec    0   1.19 MBytes       
[  4]   5.00-6.00   sec   525 MBytes  4.41 Gbits/sec    0   1.19 MBytes       
[  4]   6.00-7.00   sec   544 MBytes  4.56 Gbits/sec    0   1.19 MBytes       
[  4]   7.00-8.00   sec   529 MBytes  4.43 Gbits/sec    0   1.19 MBytes       
[  4]   8.00-9.00   sec   530 MBytes  4.45 Gbits/sec    0   1.19 MBytes       
[  4]   9.00-10.00  sec   528 MBytes  4.43 Gbits/sec    0   1.19 MBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
Test Complete. Summary Results:
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  5.10 GBytes  4.38 Gbits/sec    0             sender
[  4]   0.00-10.00  sec  5.09 GBytes  4.37 Gbits/sec                  receiver
CPU Utilization: local/sender 81.2% (1.6%u/79.7%s), remote/receiver 65.8% (1.9%u/63.9%s)

iperf Done.
pi@raspberrypi:~ </pre>    <span style="color: #008080;">‧ Connected by RPI 3B+ boot from USB flash drive</span> <pre class="lang:default decode:true">pi@raspberrypi:~ iperf3 -c 5.168.168.5 -V
iperf 3.1.3
Linux raspberrypi 4.14.70-v7+ #1144 SMP Tue Sep 18 17:34:46 BST 2018 armv7l
Time: Sat, 22 Sep 2018 08:31:15 GMT
Connecting to host 5.168.168.5, port 5201
      Cookie: raspberrypi.1537605075.760197.69cb49
      TCP MSS: 1448 (default)
[  4] local 5.168.168.6 port 58988 connected to 5.168.168.5 port 5201
Starting Test: protocol: TCP, 1 streams, 131072 byte blocks, omitting 0 seconds, 10 second test
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  29.2 MBytes   245 Mbits/sec    0    604 KBytes       
[  4]   1.00-2.00   sec  26.2 MBytes   219 Mbits/sec    0    635 KBytes       
[  4]   2.00-3.00   sec  26.1 MBytes   219 Mbits/sec    0    635 KBytes       
[  4]   3.00-4.02   sec  27.5 MBytes   226 Mbits/sec    0    635 KBytes       
[  4]   4.02-5.00   sec  26.7 MBytes   228 Mbits/sec    0    635 KBytes       
[  4]   5.00-6.00   sec  26.6 MBytes   223 Mbits/sec    0    666 KBytes       
[  4]   6.00-7.00   sec  27.1 MBytes   227 Mbits/sec    0    666 KBytes       
[  4]   7.00-8.00   sec  28.0 MBytes   235 Mbits/sec    0    666 KBytes       
[  4]   8.00-9.00   sec  26.5 MBytes   223 Mbits/sec    0    666 KBytes       
[  4]   9.00-10.00  sec  26.5 MBytes   222 Mbits/sec    0    666 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
Test Complete. Summary Results:
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec   270 MBytes   227 Mbits/sec    0             sender
[  4]   0.00-10.00  sec   269 MBytes   225 Mbits/sec                  receiver
CPU Utilization: local/sender 5.4% (0.6%u/4.8%s), remote/receiver 9.7% (0.6%u/9.1%s)

iperf Done.
pi@raspberrypi:~ </pre>    <span style="color: #008080;">‧ Connected by RPI 3B boot from SD card</span> <pre class="lang:default decode:true ">pi@raspberrypi:~ iperf3 -c 5.168.168.5 -V
iperf 3.1.3
Linux raspberrypi 4.14.69-v7+ #1141 SMP Mon Sep 10 15:26:29 BST 2018 armv7l
Time: Sat, 22 Sep 2018 08:31:52 GMT
Connecting to host 5.168.168.5, port 5201
      Cookie: raspberrypi.1537605096.310941.3ebcea
      TCP MSS: 1448 (default)
[  4] local 5.168.168.17 port 40104 connected to 5.168.168.5 port 5201
Starting Test: protocol: TCP, 1 streams, 131072 byte blocks, omitting 0 seconds, 10 second test
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  11.3 MBytes  94.5 Mbits/sec    0   36.8 KBytes       
[  4]   1.00-2.00   sec  11.2 MBytes  94.1 Mbits/sec    0   39.6 KBytes       
[  4]   2.00-3.00   sec  11.2 MBytes  94.1 Mbits/sec    0   41.0 KBytes       
[  4]   3.00-4.00   sec  11.2 MBytes  94.3 Mbits/sec    0   50.9 KBytes       
[  4]   4.00-5.00   sec  11.3 MBytes  94.6 Mbits/sec    0   76.4 KBytes       
[  4]   5.00-6.00   sec  11.2 MBytes  94.1 Mbits/sec    0   76.4 KBytes       
[  4]   6.00-7.00   sec  11.2 MBytes  94.1 Mbits/sec    0   76.4 KBytes       
[  4]   7.00-8.00   sec  11.2 MBytes  94.1 Mbits/sec    0   76.4 KBytes       
[  4]   8.00-9.00   sec  11.2 MBytes  94.2 Mbits/sec    0   76.4 KBytes       
[  4]   9.00-10.00  sec  11.2 MBytes  94.1 Mbits/sec    0   76.4 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
Test Complete. Summary Results:
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec   112 MBytes  94.2 Mbits/sec    0             sender
[  4]   0.00-10.00  sec   112 MBytes  94.1 Mbits/sec                  receiver
CPU Utilization: local/sender 4.9% (0.4%u/4.5%s), remote/receiver 6.5% (0.7%u/5.9%s)

iperf Done.
pi@raspberrypi:~ $ 

 

自己定奪哩!!

或可更上一層樓呦☆

iperf3 python wrapper

Release v0.1.10.

iPerf3 is a tool for active measurements of the maximum achievable bandwidth on IP networks. More information on the iPerf3 utility can be found on their official website

The python iperf3 module is a wrapper around the iperf3 utility. It utilises the API libiperf that comes with the default installation. It allows you to interact with the utility in a nice and pythonic way.

warning This module is not compatible with the original iperf/iperf2 utility which is no longer under active development

※ 安裝︰

sudo pip3 install iperf3