dperf 是一款基于 DPDK 的 100Gbps 網(wǎng)絡(luò)性能和負(fù)載測(cè)試軟件,能夠每秒建立千萬級(jí)的 HTTP 連接、億級(jí)別的并發(fā)請(qǐng)求和數(shù)百 Gbps 的吞吐量。
優(yōu)點(diǎn)
性能強(qiáng)大:
- 基于 DPDK,使用一臺(tái)普通 x86 服務(wù)器就可以產(chǎ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 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 并發(fā)連接數(shù)
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 |
測(cè)試環(huán)境配置
dperf 的以上性能數(shù)據(jù),基于下面的配置測(cè)試得到:
- 內(nèi)存: 512GB(大頁 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ù)
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
開始使用
設(shè)置大頁
#參考如下參數(shù)編輯 '/boot/grub2/grub.cfg',然后重啟OS
linux16 /vmlinuz-... nopku transparent_hugepage=never default_hugepagesz=1G hugepagesz=1G hugepages=8
編譯 DPDK
#編輯'config/common_base'打開PMD開關(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 dperf
make -j8 RTE_SDK=/root/dpdk/dpdk-stable-19.11.10 RTE_TARGET=$TARGET
綁定網(wǎng)卡
#Mellanox網(wǎng)卡跳過此步
#假設(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)聽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
開源地址:https://github.com/baidu/dperf
近期熱文推薦:
1.1,000+ 道 Java面試題及答案整理(2022最新版)
2.勁爆!Java 協(xié)程要來了。。。
3.Spring Boot 2.x 教程,太全了!
4.別再寫滿屏的爆爆爆炸類了,試試裝飾器模式,這才是優(yōu)雅的方式??!
5.《Java開發(fā)手冊(cè)(嵩山版)》最新發(fā)布,速速下載!文章來源:http://www.zghlxwxcb.cn/news/detail-511130.html
覺得不錯(cuò),別忘了隨手點(diǎn)贊+轉(zhuǎn)發(fā)哦!文章來源地址http://www.zghlxwxcb.cn/news/detail-511130.html
到了這里,關(guān)于狂收 3.2k star!百度開源壓測(cè)工具,可模擬幾十億的并發(fā)場(chǎng)景,太強(qiáng)悍了!的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!