使用apache的ab對頁面進行壓力測試

ab是apache自帶的一個很好用的壓力測試工具,當安裝完apache的時候,就能夠在bin下面找到abhtml

 

咱們能夠模擬100個併發用戶,對一個頁面發送1000個請求apache

./ab -n1000 -c100 http://www.cnblogs.com/pick/服務器

 

其中-n表明請求數,-c表明併發數( 詳細參數能夠用ab --help 查看)併發

 

返回結果:工具

##首先是apache的版本信息 測試

This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/.net

Benchmarking www.cnblogs.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requestshtm


Server Software:
Server Hostname: www.cnblogs.com
Server Port: 80blog

Document Path: /pick/
Document Length: 40990 bytesrequests

Concurrency Level: 100  ##併發數 
Time taken for tests: 8.385 seconds  ##共使用了多少時間 
Complete requests: 1000   ##請求數 
Failed requests: 616      ##失敗請求 
(Connect: 0, Receive: 0, Length: 616, Exceptions: 0)
Write errors: 0
Total transferred: 41420957 bytes  ##總共傳輸字節數,包含http的頭信息等 
HTML transferred: 41111501 bytes  ##html字節數,實際的頁面傳遞字節數 
Requests per second: 119.27 [#/sec] (mean)  ##每秒多少請求,這個是很是重要的參數數值,服務器的吞吐量 
Time per request: 838.456 [ms] (mean)  ##用戶平均請求等待時間 
Time per request: 8.385 [ms] (mean, across all concurrent requests)  ##服務器平均處理時間,也就是服務器吞吐量的倒數 
Transfer rate: 4824.36 [Kbytes/sec] received   ##每秒獲取的數據長度

Connection Times (ms)
      min    mean[+/-sd]   median   max
Connect:    24     225   532.6       29        7028
Processing: 50    396   916.4    88      6164
Waiting:     25    133   473.9    31      3040
Total:     75    621   1095.1   129     7196

Percentage of the requests served within a certain time (ms)
50% 129  ## 50%的請求在129ms內返回
66% 164  ## 66%的請求在164ms內返回 
75% 401
80% 1102
90% 1675
95% 3435
98% 4130
99% 4160
100% 7196 (longest request)

 

說明:考慮到帶寬不在測試的範圍,ab壓力測試應該在內網測試。

相關文章
相關標籤/搜索