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 打開日志
選項->日志查看