網站性能測試工具—ApacheBench
對于網站性能測試來說,一般我們會使用loadrunner來實現,而它過于龐大,使我們感到有些不爽,而今天介紹的ApacheBench工具,它小而精,使用簡單,效果直觀,可以說,是比lr更好用的性能測試工具.
下面介紹幾個概念
1:吞吐率(Requests per second)
服務器并發處理能力的量化描述,單位是reqs/s,指的是某個并發用戶數下單位時間內處理的請求數。某個并發用戶數下單位時間內能處理的最大請求數,稱之為最大吞吐率。
記住:吞吐率是基于并發用戶數的。這句話代表了兩個含義,1:吞吐率和并發用戶數相關;2:不同的并發用戶數下,吞吐率一般是不同的。
計算公式:總請求數 / 處理完成這些請求數所花費的時間,即
Request per second = Complete requests / Time taken for tests
2:并發連接數(The number of concurrent connections)
并發連接數指的是某個時刻服務器所接受的請求數目,簡單的講,就是一個會話。
3:并發用戶數(The number of concurrent users,Concurrency Level)
要注意區分這個概念和并發連接數之間的區別,一個用戶可能同時會產生多個會話,也即連接數。在HTTP/1.1下,IE7支持兩個并發連接,IE8支持6個并發連接,FireFox3支持4個并發連接,所以相應的,我們的并發用戶數就得除以這個基數。
下面主要說一下它的幾個主要的參數
運行參數
請求為100,并發為10,命令如下:ApacheBench -n100 -c10 http://uri
運行結果
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 Finished 1000 requests Server Software: Server Hostname: www.cnblogs.com Server Port: 80 Document Path: / Document Length: 45373 bytes Concurrency Level: 10 Time taken for tests: 45.299591 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 45679011 bytes HTML transferred: 45373000 bytes Requests per second: 22.08 [#/sec] (mean) Time per request: 452.996 [ms] (mean) Time per request: 45.300 [ms] (mean, across all concurrent requests) Transfer rate: 984.73 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 26 44 189.5 31 3035 Processing: 89 405 583.3 284 5190 Waiting: 30 143 344.6 97 5031 Total: 116 450 611.7 315 5224 Percentage of the requests served within a certain time (ms) 50% 315 66% 322 75% 331 80% 343 90% 408 95% 549 98% 3333 99% 3375 100% 5224 (longest request) |
posted on 2014-07-18 10:00 順其自然EVO 閱讀(254) 評論(0) 編輯 收藏 所屬分類: 測試學習專欄 、性能測試