ab指令的語法是 ab -c {同時進行的request數量} -n {次數} {url}
例如:
同時連線數: 100 人
ab -n 100 -c 100 http://xx.xx.xx.xx/index.php
C:\Apache\bin>ab -n 100 -c 100 http://192.168.1.103/index.php
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/
Benchmarking 192.168.1.103 (be patient).....done
Server Software: Apache
Server Hostname: 192.168.1.103
Server Port: 80
Document Path: /index.php
Document Length: 2261 bytes
Concurrency Level: 100
Time taken for tests: 5.432 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 257300 bytes
HTML transferred: 226100 bytes
Requests per second: 18.41 [#/sec] (mean)
Time per request: 5432.000 [ms] (mean)
Time per request: 54.320 [ms] (mean, across all concurrent requests)
Transfer rate: 46.26 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 2 7 43.5 2 438
Processing: 292 2631 1352.8 2680 4916
Waiting: 289 2629 1352.9 2678 4915
Total: 295 2638 1348.1 2686 4918
Percentage of the requests served within a certain time (ms)
50% 2686
66% 3401
75% 3733
80% 3875
90% 4534
95% 4666
98% 4720
99% 4918
100% 4918 (longest request)
後面的幾行粗體字資料是整個回應等候時間的統計,算是 Apache Benchmark 的數據價值精華所在。這些數據表示了這 100 個人所感受到的回應速度統計。以上面這個例子來說,此次執行結果顯示這次測試結果從 2.282 秒到 4.918 秒不等。 其中50%(50)的使用者感受的反應時間是 2.686 秒以下, 90%(90)的使用者感受的反應時間是 4.534 秒中以下,所有的人均在 4.918 秒內得到回應。
沒有留言:
張貼留言