1.安裝perf工具
命令:
apt-get install linux-tools-common
apt-get install linux-tools-4.15.0-48-generic
apt-get install linux-tools-4.15.0-48-generic
apt-get install perf
2.啟動被測服務
命令:./server_linux
3.測試服務是否啟動成功(開第二個終端)
命令:curl http://localhost:12306/perf_issue
如圖顯示啟動成功:
4.壓被測服務
命令:wrk -d100s -c100 -t10 http://localhost:12306/perf_issue
結果如圖:
qps=28.46
5.繼續壓測,打開第三個終端
使用命令:perf top
可以看出被測服務server_linux很忙。
使用上下鍵選擇server_linux按兩下Enter鍵,如圖:
可以看出大量時間消耗在addsd命令上。