百度又開(kāi)源一款壓測(cè)工具,可模擬幾十億的并發(fā)場(chǎng)景,太強(qiáng)悍了!
2023-08-18 23:06 作者:一起學(xué)chatGPT一起學(xué)ai | 我要投稿
優(yōu)點(diǎn)
性能強(qiáng)大:
- 基于 DPDK,使用一臺(tái)普通 x86 服務(wù)器就可以產(chǎn)生巨大的流量:千萬(wàn)級(jí)的 HTTP 每秒新建連接數(shù),數(shù)百 Gbps 的帶寬,幾十億的并發(fā)連接數(shù)
統(tǒng)計(jì)信息詳細(xì):
- 能夠輸出詳細(xì)的統(tǒng)計(jì)信息,并且識(shí)別每一個(gè)丟包
使用場(chǎng)景豐富:
- 可用于對(duì)四層負(fù)載均衡等四層網(wǎng)關(guān)進(jìn)行性能壓力測(cè)試、長(zhǎng)穩(wěn)測(cè)試
- 可用于對(duì)云上虛擬機(jī)的網(wǎng)絡(luò)性能進(jìn)行測(cè)試
- 可用于對(duì)網(wǎng)卡性能、CPU 的網(wǎng)絡(luò)報(bào)文處理能力進(jìn)行測(cè)試壓測(cè)場(chǎng)景下,可作為高性能的 HTTP Server 或 HTTP Client 單獨(dú)使用
性能
HTTP 每秒新建連接數(shù)
Client CoresServer CoresHTTP CPS112,101,044224,000,423447,010,7436610,027,172HTTP 吞吐
Client CoresServer CoresRX(Gbps)TX(Gbps)Client CPU Usage(%)Server CPU Usage(%)111818605922353560594446464343HTTP 并發(fā)連接數(shù)
Client CoresServer CoresCurrent ConnectionsClient CPU Usage(%)Server CPU Usage(%)11100,000,000343922200,000,000363944400,000,0004041UDP TX PPS
Client CoresTX MPPSClient CPU Usage(%)115.9695229.9595434.9267635.9254837.1222測(cè)試環(huán)境配置
dperf 的以上性能數(shù)據(jù),基于下面的配置測(cè)試得到:
- 內(nèi)存: 512GB(大頁(yè) 100GB)
- 網(wǎng)卡: Mellanox MT27710 25Gbps * 2
- 內(nèi)核: 4.19.90
統(tǒng)計(jì)數(shù)據(jù)
dperf 每秒輸出多種統(tǒng)計(jì)數(shù)據(jù):
- TPS, CPS, 各種維度的 PPS
- TCP/Socket/HTTP 級(jí)別的錯(cuò)誤數(shù)
- 丟包數(shù)
- 按照 TCP Flag 分類的報(bào)文重傳數(shù)
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
開(kāi)始使用
設(shè)置大頁(yè)
#參考如下參數(shù)編輯 '/boot/grub2/grub.cfg',然后重啟OSlinux16 /vmlinuz-... nopku transparent_hugepage=never default_hugepagesz=1G hugepagesz=1G hugepages=8
編譯 DPDK
#編輯'config/common_base'打開(kāi)PMD開(kāi)關(guān)#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 dperfmake -j8 RTE_SDK=/root/dpdk/dpdk-stable-19.11.10 RTE_TARGET=$TARGET
綁定網(wǎng)卡
#Mellanox網(wǎng)卡跳過(guò)此步#假設(shè)PCI號(hào)是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
啟動(dòng) dperf server
#dperf server監(jiān)聽(tīng)6.6.241.27:80, 網(wǎng)關(guān)是6.6.241.1./build/dperf -c test/http/server-cps.conf
從客戶端發(fā)送請(qǐng)求
#客戶端IP必須要在配置文件的'client'范圍內(nèi)ping 6.6.241.27
curl http://6.6.241.27/
運(yùn)行測(cè)試
下面的例子運(yùn)行一個(gè) HTTP CPS 壓力測(cè)試。在 server 端運(yùn)行 dperf ./build/dperf -c test/http/server-cps.conf
#以另一臺(tái)機(jī)器作為client端,運(yùn)行dperf./build/dperf -c test/http/client-cps.conf