ab壓力測試

原文連接:http://www.orlion.ga/698/php

ab是個什麼就不說了搞lamp的都會知道。主要看一下結果都是什麼意義。html

 

ab 的用法是:ab [options] [http://]hostname[:port]/pathapache

例如:ab -n 5000 -c 200 http://localhost/index.php服務器

上例表示總共訪問http://localhost/index.php這個腳本5000次,200併發同時執行網絡

 

ab經常使用參數的介紹:併發

-n :總共的請求執行數,缺省是1;測試

-c: 併發數,缺省是1;spa

-t:測試所進行的總時間,秒爲單位,缺省50000shtm

-p:POST時的數據文件get

-w: 以HTML表的格式輸出結果

 

執行測試用例:ab -n 1000 -c 100 -w http://localhost/index.php >>c:\1.html

上面的測試用例表示100併發的狀況下,共測試訪問index.php腳本1000次,並將測試結果保存到c:\1.html文件中。

 

測試一下:

    ab -n 1000 -c 100 http://localhost/index.php

    測試結果以下:

    

結果解釋一下:

    

Server Software:        Apache/2.4.9    ##apache版本 
Server Hostname:        localhost  ##請求的機子 
Server Port:            80 ##請求端口

Document Path:          /index.php 
Document Length:        5456 bytes  ##頁面長度

Concurrency Level:      100  ##併發數 
Time taken for tests:   4.591seconds  ##共使用了多少時間 
Complete requests:      1000   ##請求數 
Failed requests:        0   ##失敗請求 
Write errors:           0   
Total transferred:      5645000bytes  ##總共傳輸字節數,包含http的頭信息等 
HTML transferred:       5456000bytes  ##html字節數,實際的頁面傳遞字節數 
Requests per second:    217.81 [#/sec] (mean)  ##每秒多少請求,這個是很是重要的參數數值,服務器的吞吐量 
Time per request:       459.126[ms] (mean)  ##用戶平均請求等待時間 
Time per request:       4.591 [ms] (mean, across all concurrent requests)  ##併發的每一個請求平均消耗時間 

Transfer rate:          1200.69[Kbytes/sec] received  ##平均每秒網絡上的流量,能夠幫助排除是否存在網絡流量過大致使響應時間延長的問題

Connection Times(ms)    網絡上消耗的時間的分解

Percentage of the requests served within a certain time (ms)   50%     434  ## 50%的請求在434ms內返回   66%     442 ## 60%的請求在442ms內返回 …

相關文章
相關標籤/搜索