dperf 是一款基於 DPDK 的 100Gbps 網路性能和負載測試軟體,能夠每秒建立千萬級的 HTTP 連接、億級別的併發請求和數百 Gbps 的吞吐量。 ## 優點 ### 性能強大: - 基於 DPDK,使用一臺普通 x86 伺服器就可以產生巨大的流量:千萬級的 HTTP 每秒新建連接數, ...
dperf 是一款基於 DPDK 的 100Gbps 網路性能和負載測試軟體,能夠每秒建立千萬級的 HTTP 連接、億級別的併發請求和數百 Gbps 的吞吐量。
優點
性能強大:
- 基於 DPDK,使用一臺普通 x86 伺服器就可以產生巨大的流量:千萬級的 HTTP 每秒新建連接數,數百 Gbps 的帶寬,幾十億的併發連接數
統計信息詳細:
- 能夠輸出詳細的統計信息,並且識別每一個丟包
使用場景豐富:
- 可用於對四層負載均衡等四層網關進行性能壓力測試、長穩測試
- 可用於對雲上虛擬機的網路性能進行測試
- 可用於對網卡性能、CPU 的網路報文處理能力進行測試
- 壓測場景下,可作為高性能的 HTTP Server 或 HTTP Client 單獨使用
性能
HTTP 每秒新建連接數
Client Cores | Server Cores | HTTP CPS |
---|---|---|
1 | 1 | 2,101,044 |
2 | 2 | 4,000,423 |
4 | 4 | 7,010,743 |
6 | 6 | 10,027,172 |
HTTP 吞吐
Client Cores | Server Cores | RX(Gbps) | TX(Gbps) | Client CPU Usage(%) | Server CPU Usage(%) |
---|---|---|---|---|---|
1 | 1 | 18 | 18 | 60 | 59 |
2 | 2 | 35 | 35 | 60 | 59 |
4 | 4 | 46 | 46 | 43 | 43 |
HTTP 併發連接數
Client Cores | Server Cores | Current Connections | Client CPU Usage(%) | Server CPU Usage(%) |
---|---|---|---|---|
1 | 1 | 100,000,000 | 34 | 39 |
2 | 2 | 200,000,000 | 36 | 39 |
4 | 4 | 400,000,000 | 40 | 41 |
UDP TX PPS
Client Cores | TX MPPS | Client CPU Usage(%) |
---|---|---|
1 | 15.96 | 95 |
2 | 29.95 | 95 |
4 | 34.92 | 67 |
6 | 35.92 | 54 |
8 | 37.12 | 22 |
測試環境配置
dperf 的以上性能數據,基於下麵的配置測試得到:
- 記憶體: 512GB(大頁 100GB)
- 網卡: Mellanox MT27710 25Gbps * 2
- 內核: 4.19.90
統計數據
dperf 每秒輸出多種統計數據:
- TPS, CPS, 各種維度的 PPS
- TCP/Socket/HTTP 級別的錯誤數
- 丟包數
- 按照 TCP Flag 分類的報文重傳數
seconds 22 cpuUsage 52
pktRx 3,001,058 pktTx 3,001,025 bitsRx 2,272,799,040 bitsTx 1,920,657,600 dropTx 0
arpRx 0 arpTx 0 icmpRx 0 icmpTx 0 otherRx 0 badRx 0
synRx 1,000,345 synTx 1,000,330 finRx 1,000,350 finTx 1,000,350 rstRx 0 rstTx 0
synRt 0 finRt 0 ackRt 0 pushRt 0 tcpDrop 0
skOpen 1,000,330 skClose 1,000,363 skCon 230 skErr 0
httpGet 1,000,345 http2XX 1,000,350 httpErr 0
ierrors 0 oerrors 0 imissed 0
開始使用
設置大頁
#參考如下參數編輯 '/boot/grub2/grub.cfg',然後重啟OS
linux16 /vmlinuz-... nopku transparent_hugepage=never default_hugepagesz=1G hugepagesz=1G hugepages=8
編譯 DPDK
#編輯'config/common_base'打開PMD開關
#Mellanox CX4/CX5 requires 'CONFIG_RTE_LIBRTE_MLX5_PMD=y'
#HNS3 requires 'CONFIG_RTE_LIBRTE_HNS3_PMD=y'
#VMXNET3 requires 'CONFIG_RTE_LIBRTE_VMXNET3_PMD=y'
TARGET=x86_64-native-linuxapp-gcc #or arm64-armv8a-linuxapp-gcc
cd /root/dpdk/dpdk-stable-19.11.10
make install T=$TARGET -j16
編譯 dperf
cd dperf
make -j8 RTE_SDK=/root/dpdk/dpdk-stable-19.11.10 RTE_TARGET=$TARGET
綁定網卡
#Mellanox網卡跳過此步
#假設PCI號是0000:1b:00.0
modprobe uio
modprobe uio_pci_generic
/root/dpdk/dpdk-stable-19.11.10/usertools/dpdk-devbind.py -b uio_pci_generic 0000:1b:00.0
啟動 dperf server
#dperf server監聽6.6.241.27:80, 網關是6.6.241.1
./build/dperf -c test/http/server-cps.conf
從客戶端發送請求
#客戶端IP必須要在配置文件的'client'範圍內
ping 6.6.241.27
curl http://6.6.241.27/
運行測試
下麵的例子運行一個 HTTP CPS 壓力測試。在 server 端運行 dperf ./build/dperf -c test/http/server-cps.conf
#以另一臺機器作為client端,運行dperf
./build/dperf -c test/http/client-cps.conf
開源地址:https://github.com/baidu/dperf
近期熱文推薦:
1.1,000+ 道 Java面試題及答案整理(2022最新版)
4.別再寫滿屏的爆爆爆炸類了,試試裝飾器模式,這才是優雅的方式!!
覺得不錯,別忘了隨手點贊+轉發哦!