〝 古人學問遺無力,少壯功夫老始成 〞
很多小伙伴在做完一個網站之后,不知道如何做壓力測驗,不知道自己網站的并發承受極限在哪里,這里教大家兩種最常用的兩種壓力測驗,如果這篇文章能給你帶來一點幫助,希望給飛兔小哥哥一鍵三連,表示支持,謝謝各位小伙伴們,
目錄
一、webbench測驗之安裝webbench
二、webbench測驗之使用
三、webbench測驗之結果分析
四、apachebench壓力測驗
五、apachebench測驗之結果分析
一、webbench測驗之安裝webbench
- 首先需要安裝webbench的依賴
- 再安裝webbench服務
# 安裝依賴
yum install ctags
# 安裝服務包
wget http://www.ha97.com/code/webbench-1.5.tar.gz
# 解壓
tar -zxvf webbench-1.5.tar.gz
# 進入作業目錄
cd webbench-1.5
# 編譯
make && make install
二、webbench測驗之使用
- 使用命令:webbench -c 并發數 -t 請求時間 壓力測驗的網址
- 如果我要測驗百度在30秒內并發數1000情況下的壓力,命令如下
webbench -c 1000 -t 30 https://www.baidu.com
三、webbench測驗之結果分析
- 在運行完以上命令后,可以看出網站負載的具體情況了
- 主要看failed數量,看請求有多少失敗即可
Speed=24920 pages/min, 21037312 bytes/sec.
Requests: 24833 susceed, 87 failed.
四、apachebench壓力測驗
- 只要安裝了apache服務,系統將會自帶ab測驗
- 使用命令:ab -c 并發數 -n 請求總數 壓力測驗網站
- 如果我要測驗百度最高并發10的情況下有100個請求過來的情況下,命令如下
ab -c 10 -n 100 https://www.baidu.com
五、apachebench測驗之結果分析
- 主要看Failed requests的數值,如果不為0則壓力超過負荷了
Server Software: nginx/1.10.2 #服務器型別
Server Hostname: www.baidu.com #域名
Server Port: 80 #埠
Document Path: / #根目錄
Document Length: 10 bytes
Concurrency Level: 10
Time taken for tests: 2.677 seconds #測驗時間
Complete requests: 100 #完成的請求數量
Failed requests: 0 #失敗的請求
Total transferred: 17200 bytes
HTML transferred: 1000 bytes
Requests per second: 37.36 [#/sec] (mean)
Time per request: 267.700 [ms] (mean)
Time per request: 26.770 [ms] (mean, across all concurrent requests)
Transfer rate: 6.27 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 7 26 140.0 10 1411
Processing: 11 231 414.8 93 1650
Waiting: 11 196 412.7 68 1637
Total: 20 257 434.9 104 1666
Percentage of the requests served within a certain time (ms)
50% 104 #50%的請求處理時間在100毫秒左右
66% 140
75% 146
80% 152
90% 1516
95% 1538
98% 1548
99% 1666
100% 1666 (longest request)
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/396139.html
標籤:其他
下一篇:nginx根據引數路由
