tomcat AB測試結果分析

AB測試,200個請求,20個併發.這樣的測試強度,CPU佔了70-80%,w3p佔用了70多M內存,本想多測幾次,看看它的內存會不會漲上去,沒 有測試機器沒辦法,開發機要幹活.我估計CPU就有問題了,性能有好些個地方還需要優化.


順便把測試的工具用法作個記號


基本用法:

ab -n 全部請求數 -c 併發數 測試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           #併發數  

Time taken for tests:   92.76140 seconds #全部請 求完成耗時

Complete requests:      10000          #全部請求數

Failed requests:        1974           #失敗的請求

  (Connect: 0, Length: 1974, Exceptions: 0)

Write errors:           0

Total transferred:      827019400 bytes   #總傳輸大小 

HTML transferred:       825219400 bytes #整個場 景中的HTML內容傳輸量

Requests per second:    108.61 [#/sec] (mean)   #每秒請 求數(平均)//大家最關心的指標之一,相當於 LR 中的每秒事務數,後面括 號中的 mean 表示這是一個平均值

Time per request:       460.381 [ms] (mean)   #每次併發請求時間(所有併發) //大家最關心的指標之二,相當於 LR 中的平均事務響應時間, 後面括號中的 mean 表示這是一個平均值

Time per request:       9.208 [ms] (mean, across all concurrent requests)   #每一請求時間(併發平均)  //每個請求實際運行時間的平均值

Transfer rate:          8771.39 [Kbytes/sec] received    #傳輸速 率//平 均每秒網絡上的流量,可以幫助排除是否存在網絡流量過大導致響應時間延長的問題

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)

//整個場景中所有請求的響應情況。在場景中每個請求都有一個響應時間,其 中50%的用戶響應時間小於2680毫秒,60% 的用戶響應時間小於2806毫秒,最大的響應時間小於21417毫秒

由於對於併發請求,cpu實際上並不是同時處理的,而是按照每個 請求獲得的時間片逐個輪轉處理的,所以基本上第一個Time per request時間約等於第二個Time per request時間乘以併發請求數。



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





其 它參數:


-n requests     全部請求數

-c concurrency  併發數

-t timelimit    最傳等待迴應時間

-p postfile     POST數 據文件

-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   代理服務器

-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個併發.這樣的測試強度,CPU佔了70-80%,w3p佔用了70多M內存,本想多測幾次,看看它的內存會不會漲上去,沒 有測試機器沒辦法,開發機要幹活.我估計CPU就有問題了,性能有好些個地方還需要優化.


順便把測試的工具用法作個記號


基本用法:

ab -n 全部請求數 -c 併發數 測試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           #併發數  

Time taken for tests:   92.76140 seconds #全部請 求完成耗時

Complete requests:      10000          #全部請求數

Failed requests:        1974           #失敗的請求

  (Connect: 0, Length: 1974, Exceptions: 0)

Write errors:           0

Total transferred:      827019400 bytes   #總傳輸大小 

HTML transferred:       825219400 bytes #整個場 景中的HTML內容傳輸量

Requests per second:    108.61 [#/sec] (mean)   #每秒請 求數(平均)//大家最關心的指標之一,相當於 LR 中的每秒事務數,後面括 號中的 mean 表示這是一個平均值

Time per request:       460.381 [ms] (mean)   #每次併發請求時間(所有併發) //大家最關心的指標之二,相當於 LR 中的平均事務響應時間, 後面括號中的 mean 表示這是一個平均值

Time per request:       9.208 [ms] (mean, across all concurrent requests)   #每一請求時間(併發平均)  //每個請求實際運行時間的平均值

Transfer rate:          8771.39 [Kbytes/sec] received    #傳輸速 率//平 均每秒網絡上的流量,可以幫助排除是否存在網絡流量過大導致響應時間延長的問題

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)

//整個場景中所有請求的響應情況。在場景中每個請求都有一個響應時間,其 中50%的用戶響應時間小於2680毫秒,60% 的用戶響應時間小於2806毫秒,最大的響應時間小於21417毫秒

由於對於併發請求,cpu實際上並不是同時處理的,而是按照每個 請求獲得的時間片逐個輪轉處理的,所以基本上第一個Time per request時間約等於第二個Time per request時間乘以併發請求數。



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





其 它參數:


-n requests     全部請求數

-c concurrency  併發數

-t timelimit    最傳等待迴應時間

-p postfile     POST數 據文件

-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   代理服務器

-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)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章