# 效能量測 ## 1.flowgrind >TCP RTT Testing ### Install ``` sudo apt install flowgrind or git clone flowgrind repo then compile, install ``` ### Usage ``` #Activate flowgrind daemons on each side of flow end-to-end Src bash$ flowgrindd Dst bash$ flowgrindd #Generate 1 flow from src to dst src bash$flowgrind -H s=src_ip,d=dst_ip #Generate 1 flow from src to dst $ flowgrind -H s=10.0.100.1,d=60.60.0.1 -A s -i 1 -T s=60 ``` ``` #Generate 2 flow from src to dst src bash$flowgrind -n 2 -F 1 -H s=src_ip,d=dst_ip -F 2 -H s=src_ip,d=dst_ip ``` ``` #Other parameter -i, log interval -n, flow number, each flow need to specify -A s, check src side rtt -F, flow description 描述flow src, dst ``` > Ref: https://manpages.ubuntu.com/manpages/xenial/man1/flowgrind.1.html ### Issue 最後統計的RTT不太準 check log RTT 多條flow需要用 -F ## 2. iperf3 > udp tcp, throughput testing ### Install ### Usage ``` Dst side: iperf3 -s Src side: iperf3 -c <dst side ip> -b <bandwidth> -p <port> -P <flow-number> <-u, udp mode> -t <time> -l <packet_length> ``` ### Issue default 打tcp throughput 數據只計算payload 所以打滿Link capacity的情況下數據會比Link capacity稍微少一點 iperf3 udp效能很差, udp大流量需使用iperf > 打TCP須注意TCP Maximum Segment Size 多個小風包會在linux kernel聚合變成一個大風包,導致pps降低 bits/sec上升 ## 3. TRex (DPDK Based Packet Generate) ### Installation ``` Cisco Offical Install Document https://trex-tgn.cisco.com/trex/doc/trex_manual.html #_download_and_installation ``` ### 安裝懶人包 ``` #安裝最新版 wget --no-cache https://trex-tgn.cisco.com/trex/release/latest tar -xzvf latest #安裝特定版本 2022/10/10 論文用v2.60 wget --no-cache https://trex-tgn.cisco.com/trex/release/vX.XX.tar.gz tar -xzvf vX.XX.tar.gz ``` ### Usage #### Testing Topo TRex機器接兩條Port到測試機器 (Device under Testing) 1TX 1RX ![](https://i.imgur.com/W4XS65w.png) #### First Setting ``` bash$cd v2.60 #TRex的資料夾 bash$sudo dpdk_setup_ports.py -i #進入TRex Interactive Script設置 ``` #### TRex Interactive Script ``` By default, IP based configuration file will be created. Do you want to use MAC based config? (y/N)y # 接下來會列出這台電腦上所有實體網卡 # 下個問題選擇你要測試用的那兩個網卡的Port Enter list of interfaces separated by space (for example: 1 3) : 2 3 #(Port1, Port2) Destination MAC is 98:03:9b:1a:15:6b. Change it to MAC of DUT? (y/N).y Please enter new destination MAC of interface 2: e4:11:22:33:44:50 #(DUT port1的MAC) For interface 3, assuming loopback to it's dual interface 2. Destination MAC is 98:03:9b:1a:15:6a. Change it to MAC of DUT? (y/N).y Please enter new destination MAC of interface 3: e4:11:22:33:44:52 #(DUT port2的MAC) Print preview of generated config? (Y/n) Save the config to file? (Y/n)Y Default filename is /etc/trex_cfg.yaml Press ENTER to confirm or enter new file: File /etc/trex_cfg.yaml already exist, overwrite? (y/N)y Saved to /etc/trex_cfg.yaml. #日後要改SRC DST mac可直接改此路徑檔案的Value ``` ### Run TRex #### Tmux panel 1 ``` cd v2.60 ./t-rex-64-o -i -c 10 ``` > #-c core num, 進入TRex main program > TRex會自動根據前面的設定幫用到的NIC綁定DPDK Driver #### Tmux panel 2 ``` cd v2.60 ./trex-console ``` >進入TRex control plane CLI 用來控制TRex main program如何產生packets ``` trex>start -f stl/bench.py -p 0 -m 100% -t size=512 --force ``` > 開始打流量,TRex產生的流量由Python Script來描述,範例在v2.60/stl/內 > 若需要打GTP-U或其他種類packet需要自己寫 > -m, 產生的packets佔用NIC Capacity比率, 100%=打滿 (不太確定) > -t size=XX 封包Size > --force 強制開始執行 ``` trex>tui ``` >觀察流量數據圖 ![](https://i.imgur.com/zJqu7pP.png) ### Issue 測試Packets Per Second, Bits Per Second 測試短packet時的PPS X722不支援 > https://doc.dpdk.org/guides/nics/i40e.html X710支援 不提供Packet Order or TCP Retransmisson or TCP RTT等等數據 若RX一直為0的情況 1. DUT沒把處理過的packet送回來 2. 送回來的時後Dst MAC與TRex機器的網卡MAC不一樣 ### TODO invategate stateful TRex usage sudo apt install autoconf sudo apt install libtool sudo apt install -y build-essential automake pkg-config sudo apt install libmnl-dev