ab的全稱是ApacheBench,是 Apache 附帶的一個小工具,專門用于 HTTP Server 的benchmark testing,可以同時模拟多個并發請求。
C:\Program Files\Apache Software Foundation\Apache2.2\bin>ab -n 10 -c 10 http ://www.google.com/index.html
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/
Benchmarking www.google.com (be patient).....done
Server Software: GWS/2.1
Server Hostname: www.google.com
Server Port: 80
Document Path: /index.html
Document Length: 230 bytes
Concurrency Level: 10
Time taken for tests: 3.234651 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 6020 bytes
HTML transferred: 2300 bytes
Time per request: 3234.651 [ms] (mean)
Time per request: 323.465 [ms] (mean, across all concurrent requests)
Transfer rate: 1.55 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 20 318 926.1 30 2954
Processing: 40 2160 1462.0 3034 3154
Waiting: 40 2160 1462.0 3034 3154
Total: 60 2479 1276.4 3064 3184
Percentage of the requests served within a certain time (ms)
50% 3064
66% 3094
75% 3124
80% 3154
90% 3184
95% 3184
98% 3184
99% 3184
100% 3184 (longest request)
更多資訊
ab 不像 LR 那麼強大,但是它足夠輕便,如果隻是在開發過程中想檢查一下某個子產品的響應情況,或者做一些場景比較簡單的測試,ab 還是一個不錯的選擇——至少不用花費很多時間去學習 LR 那些複雜的功能,就更别說那 License 的價格了。
ab 是 Apache 的一個安裝元件,是以需要下載下傳 Apache 安裝後才能使用,可以通路 Apache 的項目首頁來下載下傳
http://httpd.apache.org/download.cgi
ab 的更多資訊可以參加 Apache 首頁上的描述
http://httpd.apache.org/docs/2.0/programs/ab.html