日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
聊聊云網(wǎng)絡(luò)性能測試

聊聊云網(wǎng)絡(luò)性能測試

作者:扎波特的網(wǎng)線鉗 2021-06-02 10:00:30

云計算 有幾個云上的小伙伴想測測VPC網(wǎng)絡(luò)性能,于是寫了一些dpdk代碼在阿里云上做了一個實驗,也適用于其它云。

創(chuàng)新互聯(lián)公司專業(yè)為企業(yè)提供荷塘網(wǎng)站建設(shè)、荷塘做網(wǎng)站、荷塘網(wǎng)站設(shè)計、荷塘網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計與制作、荷塘企業(yè)網(wǎng)站模板建站服務(wù),10余年荷塘做網(wǎng)站經(jīng)驗,不只是建網(wǎng)站,更提供有價值的思路和整體網(wǎng)絡(luò)服務(wù)。

本文轉(zhuǎn)載自微信公眾號「zartbot」,作者扎波特的網(wǎng)線鉗。轉(zhuǎn)載本文請聯(lián)系zartbot公眾號。

有幾個云上的小伙伴想測測VPC網(wǎng)絡(luò)性能,于是寫了一些dpdk代碼在阿里云上做了一個實驗,也適用于其它云

安裝相關(guān)的庫

使用root登錄,更新一下源

  
 
 
 
  1. #備份原有的配置文件
  2.  mkdir /etc/yum.repos.d/bak
  3.  mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/
  4. #使用阿里云的源覆蓋
  5. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
  6. yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
  7. sed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
  8. sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
  9. sudo dnf config-manager --set-enabled PowerTools
  10. yum makecache
  11. yum update
  12. yum groupinstall "Development tools"
  13. yum install gcc-gfortran kernel-modules-extra tcl tk tcsh terminator tmux kernel-rpm-macros elfutils-libelf-devel libnl3-devel meson createrepo numactl-devel
  14. pip3 install pyelftools

啟用iommu

  
 
 
 
  1. sudo vi /etc/default/grub
  2. //在 GRUB_CMDLINE_LINUX 行添加"intel_iommu=on iommu=pt" 
  3. //保存退出

然后更新grub并重啟系統(tǒng)

  
 
 
 
  1. sudo grub2-mkconfig -o /boot/grub2/grub.cfg
  2. sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
  3. sudo reboot

安裝DPDK

CentOS上需要添加/usr/local路徑, 主要是LD_LIBRARY_PATH PATH 和 PKG_CONFIG_PATH 以及sudo的path

  
 
 
 
  1. sudo vi /etc/ld.so.conf.d/dpdk.conf
  2. >>添加如下path
  3. /usr/local/lib64
  4. >>退出
  5. sudo ldconfig
  6. vim ~/.bashrc
  7. >>添加如下path
  8. export PATH=/usr/local/bin:$PATH
  9. export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:${PKG_CONFIG_PATH}
  10. 保存后source
  11. source ~/.bashrc
  12. sudo vim  /etc/sudoers
  13. >>將secure_path添加/usr/local/bin
  14. Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

然后解壓dpdk,并編譯安裝

  
 
 
 
  1. wget http://fast.dpdk.org/rel/dpdk-21.05.tar.xz
  2. tar xf dpdk-21.05.tar.xz
  3. cd dpdk-21.05
  4. meson build -D examples=all 
  5. cd build
  6. ninja
  7. sudo ninja install
  8. sudo ldconfig

設(shè)置Hugepage和bind接口

  
 
 
 
  1. dpdk-hugepages.py --setup 4G
  2.  modprobe vfio-pci
  3.  dpdk-devbind.py -s
  4. Network devices using kernel driver
  5. ===================================
  6. 0000:00:05.0 'Virtio network device 1000' if=eth0 drv=virtio-pci unused=vfio-pci *Active*
  7. 0000:00:06.0 'Virtio network device 1000' if=eth1 drv=virtio-pci unused=vfio-pci *Active*

注意虛擬機環(huán)境需要noniommu_mode

  
 
 
 
  1. ifconfig eth1 down
  2. echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode
  3. dpdk-devbind.py -b vfio-pci 0000:00:06.0

驗證

  
 
 
 
  1. dpdk-devbind.py -s
  2. Network devices using DPDK-compatible driver
  3. ============================================
  4. 0000:00:06.0 'Virtio network device 1000' drv=vfio-pci unused=
  5. Network devices using kernel driver
  6. ===================================
  7. 0000:00:05.0 'Virtio network device 1000' if=eth0 drv=virtio-pci unused=vfio-pci *Active*

檢查接口支持情況

下載代碼

  
 
 
 
  1. cd ~
  2. wget https://github.com/zartbot/learn_dpdk/archive/refs/heads/main.zip
  3. unzip main.zip
  4.  cd learn_dpdk-main/

編譯

  
 
 
 
  1. cd 01_port_init/devinfo/
  2. make clean;make

檢查接口支持情況

  
 
 
 
  1. ./build/devinfo
  2. EAL: Detected 24 lcore(s)
  3. EAL: Detected 1 NUMA nodes
  4. EAL: Detected shared linkage of DPDK
  5. EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
  6. EAL: Selected IOVA mode 'PA'
  7. EAL: No available 1048576 kB hugepages reported
  8. EAL: VFIO support initialized
  9. EAL:   Invalid NUMA socket, default to 0
  10. EAL: Probe PCI driver: net_virtio (1af4:1000) device: 0000:00:05.0 (socket 0)
  11. eth_virtio_pci_init(): Failed to init PCI device
  12. EAL: Requested device 0000:00:05.0 cannot be used
  13. EAL:   Invalid NUMA socket, default to 0
  14. EAL: Probe PCI driver: net_virtio (1af4:1000) device: 0000:00:06.0 (socket 0)
  15. EAL: Using IOMMU type 8 (No-IOMMU)
  16. TELEMETRY: No legacy callbacks, legacy socket not created
  17. *****************************************
  18. number of available port: 1
  19. =========================================
  20. port: 0         Driver:net_virtio
  21. Link down
  22. MAC address: 00:16:3E:25:3F:0A
  23. PCIe:0000:00:06.0
  24. Max RX Queue:   12      Desc:   65535
  25. Max TX Queue:   12      Desc:   65535
  26. Offload Capability:
  27.   DEV_RX_OFFLOAD_VLAN_STRIP
  28.   DEV_RX_OFFLOAD_UDP_CKSUM
  29.   DEV_RX_OFFLOAD_TCP_CKSUM
  30.   DEV_RX_OFFLOAD_TCP_LRO
  31.   DEV_RX_OFFLOAD_JUMBO_FRAME
  32. -----------------------------------------
  33.   DEV_TX_OFFLOAD_VLAN_INSERT
  34.   DEV_TX_OFFLOAD_UDP_CKSUM
  35.   DEV_TX_OFFLOAD_TCP_CKSUM
  36.   DEV_TX_OFFLOAD_TCP_TSO
  37.   DEV_TX_OFFLOAD_MULTI_SEGS
  38. =========================================

測速

  
 
 
 
  1. cd ~/learn_dpdk-main/02_send_recv/traffic_gen/

修改send_pkt.c的源目的地址,注意目的MAC在阿里云上要為eeff.ffff.ffff

  
 
 
 
  1. //init mac
  2. struct rte_ether_addr s_addr = {{0x00, 0x16, 0x3e, 0x25, 0x0b, 0xe3}};
  3. struct rte_ether_addr d_addr = {{0xee, 0xff, 0xff, 0xff, 0xff, 0xff}};
  4. //init IP header
  5. rte_be32_t s_ip_addr = string_to_ip("10.66.1.220");
  6. rte_be32_t d_ip_addr = string_to_ip("10.66.1.219");

由于接口支持有限,修改 common.h

  
 
 
 
  1. #define NUM_RX_QUEUE 1
  2. #define NUM_TX_QUEUE 1
  3. static const struct rte_eth_conf port_conf_default = {
  4.     .rxmode = {
  5.         .max_rx_pkt_len = RTE_ETHER_MAX_LEN,
  6.     .mq_mode = ETH_MQ_RX_NONE,
  7.     },
  8.     .txmode = {
  9.         .mq_mode = ETH_MQ_TX_NONE,
  10.     }
  11. };

修改portinit.c 關(guān)閉RX-CHECKSUM OFFLOAD, 注釋掉下面這段:

  
 
 
 
  1. if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_CHECKSUM)
  2.  {
  3.      printf("port[%u] support RX cheksum offload.\n", port);
  4.      port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_CHECKSUM;
  5.  }

最后測速大概3.3Mpps左右,接近官方售賣時的4Mpps

  
 
 
 
  1. [root@iZuf64vmgrtj12kczyslhdZ traffic_gen]# ./build/run
  2. EAL: Detected 24 lcore(s)
  3. EAL: Detected 1 NUMA nodes
  4. EAL: Detected shared linkage of DPDK
  5. EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
  6. EAL: Selected IOVA mode 'PA'
  7. EAL: No available 1048576 kB hugepages reported
  8. EAL: VFIO support initialized
  9. EAL:   Invalid NUMA socket, default to 0
  10. EAL: Probe PCI driver: net_virtio (1af4:1000) device: 0000:00:05.0 (socket 0)
  11. eth_virtio_pci_init(): Failed to init PCI device
  12. EAL: Requested device 0000:00:05.0 cannot be used
  13. EAL:   Invalid NUMA socket, default to 0
  14. EAL: Probe PCI driver: net_virtio (1af4:1000) device: 0000:00:06.0 (socket 0)
  15. EAL: Using IOMMU type 8 (No-IOMMU)
  16. TELEMETRY: No legacy callbacks, legacy socket not created
  17. initializing port 0...
  18. port[0] support TX UDP checksum offload.
  19. port[0] support TX TCP checksum offload.
  20. Port[0] MAC: 00:16:3e:25:0b:e3
  21. Core 1 doing RX dequeue.
  22. Core 2 doing packet enqueue.
  23. RX-Queue[0] PPS: 3280464
  24. RX-Queue[0] PPS: 3277792
  25. RX-Queue[0] PPS: 3303116
  26. RX-Queue[0] PPS: 3307443
  27. RX-Queue[0] PPS: 3296451
  28. RX-Queue[0] PPS: 3294396
  29. RX-Queue[0] PPS: 3297737
  30. RX-Queue[0] PPS: 3290069
  31. RX-Queue[0] PPS: 3279720
  32. RX-Queue[0] PPS: 3285987
  33. RX-Queue[0] PPS: 3279424

然后把common.h 中收發(fā)都改為4個線程

  
 
 
 
  1. #define NUM_RX_QUEUE 1
  2. #define NUM_TX_QUEUE 1

測試結(jié)果和官方售賣的4Mpps一致了。

  
 
 
 
  1. RX-Queue[0] PPS: 578918
  2. RX-Queue[1] PPS: 866823
  3. RX-Queue[2] PPS: 2288950
  4. RX-Queue[3] PPS: 865335

CPU Info

  
 
 
 
  1. [root@iZuf64vmgrtj12kczyslhdZ traffic_gen]# cat /proc/cpuinfo | grep Xeon
  2. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  3. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  4. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  5. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  6. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  7. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  8. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  9. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  10. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  11. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  12. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  13. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  14. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  15. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  16. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  17. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  18. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  19. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  20. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  21. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  22. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  23. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  24. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
  25. model name      : Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz

分享題目:聊聊云網(wǎng)絡(luò)性能測試
網(wǎng)站路徑:http://www.5511xx.com/article/cdddegp.html