十年網(wǎng)站開發(fā)經(jīng)驗 + 多家企業(yè)客戶 + 靠譜的建站團隊
量身定制 + 運營維護+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
AB測試,200個請求,20個并發(fā).這樣的測試強度,CPU占了70-80%,w3p占用了70多M內(nèi)存,本想多測幾次,看看它的內(nèi)存會不會漲上去,沒 有測試機器沒辦法,開發(fā)機要干活.我估計CPU就有問題了,性能有好些個地方還需要優(yōu)化.
順便把測試的工具用法作個記號
基本用法:
ab -n 全部請求數(shù) -c 并發(fā)數(shù) 測試url
例:ab -n 1000 -c 50 http://www.newdev.gztest.com/
Server Software: Microsoft-IIS/7.0
Server Hostname: www.newdev.gztest.com
Server Port: 80
Document Path:
Document Length: 82522 bytes #請求文檔大小
Concurrency Level: 50 #并發(fā)數(shù)
Time taken for tests: 92.76140 seconds #全部請 求完成耗時
Complete requests: 10000 #全部請求數(shù)
Failed requests: 1974 #失敗的請求
(Connect: 0, Length: 1974, Exceptions: 0)
Write errors: 0
Total transferred: 827019400 bytes #總傳輸大小
HTML transferred: 825219400 bytes #整個場 景中的HTML內(nèi)容傳輸量
Requests per second: 108.61 [#/sec] (mean) #每秒請 求數(shù)(平均)//大家最關(guān)心的指標之一,相當于 LR 中的每秒事務(wù)數(shù),后面括 號中的 mean 表示這是一個平均值
Time per request: 460.381 [ms] (mean) #每次并發(fā)請求時間(所有并發(fā)) //大家最關(guān)心的指標之二,相當于 LR 中的平均事務(wù)響應(yīng)時間, 后面括號中的 mean 表示這是一個平均值
Time per request: 9.208 [ms] (mean, across all concurrent requests) #每一請求時間(并發(fā)平均) //每個請求實際運行時間的平均值
Transfer rate: 8771.39 [Kbytes/sec] received #傳輸速 率//平 均每秒網(wǎng)絡(luò)上的流量,可以幫助排除是否存在網(wǎng)絡(luò)流量過大導(dǎo)致響應(yīng)時間延長的問題
Percentage of the requests served within a certain time (ms)
50% 2680
66% 2806
75% 2889
80% 2996
90% 11064
95% 20161
98% 21092
99% 21417
100% 21483 (longest request)
//整個場景中所有請求的響應(yīng)情況。在場景中每個請求都有一個響應(yīng)時間,其 中50%的用戶響應(yīng)時間小于2680毫秒,60% 的用戶響應(yīng)時間小于2806毫秒,大的響應(yīng)時間小于21417毫秒
由于對于并發(fā)請求,cpu實際上并不是同時處理的,而是按照每個 請求獲得的時間片逐個輪轉(zhuǎn)處理的,所以基本上第一個Time per request時間約等于第二個Time per request時間乘以并發(fā)請求數(shù)。
Connection Times (ms) #連接時 間
min mean[+/-sd] median max
Connect(#連接): 0 0 2.1 0 46
Processing(#處理): 31 458 94.7 438 1078
Waiting(#等待): 15 437 87.5 422 938
Total: 31 458 94.7 438 1078
其 它參數(shù):
-n requests 全部請求數(shù)
-c concurrency 并發(fā)數(shù)
-t timelimit 最傳等待回應(yīng)時間
-p postfile POST數(shù) 據(jù)文件
-T content-type POST Content-type
-v verbosity How much troubleshooting info to print
-w Print out results in HTML tables
-i Use HEAD instead of GET
-x attributes String to insert as table attributes
-y attributes String to insert as tr attributes
-z attributes String to insert as td or th attributes
-C attribute 加入cookie, eg. 'Apache=1234. (repeatable)
-H attribute 加入http頭, eg. 'Accept-Encoding: gzip'
Inserted after all normal header lines. (repeatable)
-A attribute http驗證,分隔傳遞用戶名及密碼
-P attribute Add Basic Proxy Authentication, the attributes
are a colon separated username and password.
-X proxy:port 代理服務(wù)器
-V 查看ab版本
-k Use HTTP KeepAlive feature
-d Do not show percentiles served table.
-S Do not show confidence estimators and warnings.
-g filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-h Display usage information (this message)
AB測試,200個請求,20個并發(fā).這樣的測試強度,CPU占了70-80%,w3p占用了70多M內(nèi)存,本想多測幾次,看看它的內(nèi)存會不會漲上去,沒 有測試機器沒辦法,開發(fā)機要干活.我估計CPU就有問題了,性能有好些個地方還需要優(yōu)化.
順便把測試的工具用法作個記號
基本用法:
ab -n 全部請求數(shù) -c 并發(fā)數(shù) 測試url
例:ab -n 1000 -c 50 http://www.newdev.gztest.com/
Server Software: Microsoft-IIS/7.0
Server Hostname: www.newdev.gztest.com
Server Port: 80
Document Path:
Document Length: 82522 bytes #請求文檔大小
Concurrency Level: 50 #并發(fā)數(shù)
Time taken for tests: 92.76140 seconds #全部請 求完成耗時
Complete requests: 10000 #全部請求數(shù)
Failed requests: 1974 #失敗的請求
(Connect: 0, Length: 1974, Exceptions: 0)
Write errors: 0
Total transferred: 827019400 bytes #總傳輸大小
HTML transferred: 825219400 bytes #整個場 景中的HTML內(nèi)容傳輸量
Requests per second: 108.61 [#/sec] (mean) #每秒請 求數(shù)(平均)//大家最關(guān)心的指標之一,相當于 LR 中的每秒事務(wù)數(shù),后面括 號中的 mean 表示這是一個平均值
Time per request: 460.381 [ms] (mean) #每次并發(fā)請求時間(所有并發(fā)) //大家最關(guān)心的指標之二,相當于 LR 中的平均事務(wù)響應(yīng)時間, 后面括號中的 mean 表示這是一個平均值
Time per request: 9.208 [ms] (mean, across all concurrent requests) #每一請求時間(并發(fā)平均) //每個請求實際運行時間的平均值
Transfer rate: 8771.39 [Kbytes/sec] received #傳輸速 率//平 均每秒網(wǎng)絡(luò)上的流量,可以幫助排除是否存在網(wǎng)絡(luò)流量過大導(dǎo)致響應(yīng)時間延長的問題
Percentage of the requests served within a certain time (ms)
50% 2680
66% 2806
75% 2889
80% 2996
90% 11064
95% 20161
98% 21092
99% 21417
100% 21483 (longest request)
//整個場景中所有請求的響應(yīng)情況。在場景中每個請求都有一個響應(yīng)時間,其 中50%的用戶響應(yīng)時間小于2680毫秒,60% 的用戶響應(yīng)時間小于2806毫秒,大的響應(yīng)時間小于21417毫秒
由于對于并發(fā)請求,cpu實際上并不是同時處理的,而是按照每個 請求獲得的時間片逐個輪轉(zhuǎn)處理的,所以基本上第一個Time per request時間約等于第二個Time per request時間乘以并發(fā)請求數(shù)。
Connection Times (ms) #連接時 間
min mean[+/-sd] median max
Connect(#連接): 0 0 2.1 0 46
Processing(#處理): 31 458 94.7 438 1078
Waiting(#等待): 15 437 87.5 422 938
Total: 31 458 94.7 438 1078
其 它參數(shù):
-n requests 全部請求數(shù)
-c concurrency 并發(fā)數(shù)
-t timelimit 最傳等待回應(yīng)時間
-p postfile POST數(shù) 據(jù)文件
-T content-type POST Content-type
-v verbosity How much troubleshooting info to print
-w Print out results in HTML tables
-i Use HEAD instead of GET
-x attributes String to insert as table attributes
-y attributes String to insert as tr attributes
-z attributes String to insert as td or th attributes
-C attribute 加入cookie, eg. 'Apache=1234. (repeatable)
-H attribute 加入http頭, eg. 'Accept-Encoding: gzip'
Inserted after all normal header lines. (repeatable)
-A attribute http驗證,分隔傳遞用戶名及密碼
-P attribute Add Basic Proxy Authentication, the attributes
are a colon separated username and password.
-X proxy:port 代理服務(wù)器
-V 查看ab版本
-k Use HTTP KeepAlive feature
-d Do not show percentiles served table.
-S Do not show confidence estimators and warnings.
-g filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-h Display usage information (this message)
創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國云服務(wù)器,動態(tài)BGP最優(yōu)骨干路由自動選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡(luò)助力業(yè)務(wù)部署。公司持有工信部辦法的idc、isp許可證, 機房獨有T級流量清洗系統(tǒng)配攻擊溯源,準確進行流量調(diào)度,確保服務(wù)器高可用性。佳節(jié)活動現(xiàn)已開啟,新人活動云服務(wù)器買多久送多久。