一、環境
- 系統:虛擬機 Ubuntu22.04 64bit
- 配置: 4核8G
- 設置:ulimit -n 102400
二、安裝
- 依賴安裝
sudo apt update sudo apt install ffmpeg sudo apt install nload
- zlm服務安裝參考:https://blog.csdn.net/hanbo622/article/details/149064939?sharetype=blogdetail&sharerId=149064939&sharerefer=PC&sharesource=hanbo622&spm=1011.2480.3001.8118
三、測試
test_bench_push、test_bench_pull跟MediaServer在同一目錄下,如果沒有在編譯時bulid中執行make install
- 視頻推流命令
source.200kbps.768x320.flv 下載地址:https://download.csdn.net/download/hanbo622/91923686
#端口使用ZLM服務配置[rtmp]中port ffmpeg -stream_loop -1 -re -i source.200kbps.768x320.flv -acodec copy -vcodec copy -f flv rtmp://192.168.1.109:1935/live/test
- 推流壓測
./test_bench_push -i rtmp://127.0.0.1:1935/live/test -c 500 -o rtmp://127.0.0.1:1935/live/push
- 拉流壓測
./test_bench_pull -c 500 -i rtmp://127.0.0.1:1935/live/test
四、測試查看
- top信息
top信息: top - 16:44:11 up 2:30, 8 users, load average: 5.05, 4.31, 3.02 任務: 331 total, 6 running, 325 sleeping, 0 stopped, 0 zombie %Cpu(s): 55.5 us, 6.2 sy, 0.0 ni, 35.0 id, 0.1 wa, 0.0 hi, 3.2 si, 0.0 st MiB Mem : 7917.5 total, 1428.8 free, 2897.3 used, 3591.5 buff/cache MiB Swap: 2048.0 total, 2028.5 free, 19.4 used. 4703.9 avail Mem 進程號 USER PR NI VIRT RES SHR %CPU %MEM TIME+ COMMAND 10736 root 20 0 2216040 1.6g 17708 S 238.9 21.3 11:23.96 MediaServer 10852 hslong 20 0 471716 21456 12912 S 13.3 0.3 0:12.39 test_bench_push 10859 hslong 20 0 471132 20004 11380 S 8.6 0.2 0:03.34 test_bench_pull
- nload信息
按上下鍵翻頁找到127.0.0.1(壓測使用的地址) Device lo [127.0.0.1] (2/2): ================================================================== Incoming:########################## Curr: 240.66 MBit/s############# Avg: 253.81 MBit/s############# Min: 125.35 MBit/s############# Max: 421.42 MBit/s############# Ttl: 81.04 GByte Outgoing:####################################### Curr: 240.65 MBit/s############# Avg: 253.81 MBit/s############# Min: 125.35 MBit/s############# Max: 421.43 MBit/s############# Ttl: 81.04 GByte
五、官方測試結果
- 官方測試:https://github.com/ZLMediaKit/ZLMediaKit/wiki/%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95
- 總體結果