三種高併發測試工具總結(Postman,Apache Bench,Jmeter)
阿新 • • 發佈:2020-08-17
1.Postman
2.Apache Bench
2.1.使用cmd介面進入AB的bin目錄下
C:\WINDOWS\system32>cd /d D:\XXX\Apache24\bin
2.2.輸入命令
D:\XXX\Apache24\bin>ab.exe -n 1000 -c 50 http://;localhost:8080/test
-n請求的次數,-c 併發數
2.3.具體的內容
//apache版本資訊 Benchmarking www.baidu.com (be patient).....done Server Software: BWS/1.1 //請求返回header型別,可能是nginx、apache、IIs等 Server Hostname: www.baidu.com //請求ip或者域名 Server Port: 443 //請求埠,當前請求為https所以埠為443,請求https埠80 SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128 //https埠協議 TLS Server Name: www.baidu.com Document Path: / //路徑 Document Length: 227 bytes //第一個成功返回的文件的位元組大小 Concurrency Level: 10 //併發數!!! Time taken for tests: 1.034 seconds //從建立連線到最後接受完成總時間 Complete requests: 100 //總請求數成功的 Failed requests: 0 //失敗的 Total transferred: 87200 bytes //從伺服器接收的位元組總數 HTML transferred: 22700 bytes //HTML接收位元組數 Requests per second: 96.75 [#/sec] (mean) ————每秒請求數(總請求數/總時間) Time per request: 103.359 [ms] (mean) ————使用者平均請求等待時間=concurrency * timetaken * 1000 / done 參考Jmeter、LR中的平均響應時間 Time per request: 10.336 [ms] (mean, across all concurrent requests) ————伺服器處理每個請求平均響應時間=timetaken * 1000 / done Transfer rate: 82.39 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 41 75 16.1 74 121 Processing: 10 23 12.7 19 63 Waiting: 10 21 10.8 18 54 Total: 62 99 18.5 97 168 //網路連線情況 Percentage of the requests served within a certain time (ms) 50% 97 66% 104 75% 107 80% 110 90% 126 95% 138 98% 148 99% 168 100% 168 (longest request)
3.Jmeter
3.1.執行jmeter
windows下面直接執行bin目錄下面的jmeter.bat
linux下面直接執行bin目錄下面的jmeter.sh 命令sh jmeter.sh
3.2.新增執行緒組
3.2.1 新增執行緒組
右鍵測試計劃->執行緒(使用者)->執行緒組
輸入:執行緒組名字,執行緒數,每個執行緒執行次數,使用者增長時間數
3.2.2 新增取樣器
右鍵左邊新建立的執行緒組->取樣器->http請求
輸入:協議:http,伺服器地址,埠號,路徑,內容編碼:utf-8
3.2.3 新增監聽器
右鍵左邊新建立的執行緒組->監聽器->圖形結果 察看結果數
3.2.4 開啟日誌
選項->日誌檢視