TOP > Linux > Fedoraの技 > 101-200 > 126
abを使ったベンチマークの利用法
apacheにはab(Apache HTTP server benchmarking tool)というベンチマーク測定のためのコマンドが用意されています。このabを使うことでapacheのパフォーマンスを視覚的に把握することが出来ます。"-n"がリクエスト総数のオプションとなります。
下記ではwww.fedora500.jpに対して2度の接続を行った結果を表示する例です。
# ab -n 2 http://www.fedora500.jp/
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking www.fedora500.jp (be patient).....done
Server Software: Apache/2.0.52
Server Hostname: www.fedora500.jp
Server Port: 80
Document Path: /
Document Length: 3931 bytes
Concurrency Level: 1
Time taken for johns: 0.3287 seconds
Complete requests: 2
Failed requests: 0
Write errors: 0
Non-2xx responses: 2
Total transferred: 8228 bytes
HTML transferred: 7862 bytes
Requests per second: 608.46 [#/sec] (mean)
Time per request: 1.644 [ms] (mean)
Time per request: 1.644 [ms] (mean, across all concurrent requests)
Transfer rate: 2433.83 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 1 1 0.0 1 1
Waiting: 0 0 0.0 0 0
Total: 1 1 0.0 1 1
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 1
98% 1
99% 1
100% 1 (longest request)
ログを見ると2度のアクセスがあったことが分かります。
# tail /etc/httpd/logs/access_log
192.168.0.11 - - [07/Apr/2005:13:05:29 +0900] "GET / HTTP/1.0" 403 3931
192.168.0.11 - - [07/Apr/2005:13:05:47 +0900] "GET / HTTP/1.0" 403 3931
192.168.0.11 - - [07/Apr/2005:13:05:47 +0900] "GET / HTTP/1.0" 403 3931
"-c"が同時接続数の指定で、下記は同時接続数を10で200回リクエストを実行した例です。
# ab -c 10 -n 200 http://www.fedora500.jp/
2005-12-03 作成