Apacheのパフォーマンスベンチマーク!
Updated:
最近、WordPressの動きが非常に重いので、チューニングしようと考えてます。 (Apache、PHP、MySQLの最適化等が必要かと)
でもその前に、現状を把握しないと話にならないので、Apacheのパフォーマンスを測定できるベンチマークテストツール「 ab(Apache Bench) 」をFedoraサーバで試してみました。(Apacheに標準で付属しているツールです)
以下が記録です。
本当はこの「 ab 」を実行するマシンはWebサーバではなく別のマシンがよいらしい。 (接続に要する時間の測定ができないから)
なので、ローカルマシン(Windowsマシン)のApacheから実行してみました。
※リクエストの数が多いと
Benchmarking 192.168.11.3 (be patient)...apr_poll: The timeout specified has expired (70007)
みたいなタイムアウトエラーがでてしまうんで、リクエストを少なめにしてテストしました。
C:\Program Files\Apache Software Foundation\Apache2.2\bin&>ab -n 5 -c 2 http://192.168.11.3/wordpress/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.11.3 (be patient).....done
Server Software: Apache
Server Hostname: 192.168.11.3
Server Port: 80
Document Path: /wordpress/index.php
Document Length: 0 bytes
Concurrency Level: 2
Time taken for tests: 38.047 seconds
Complete requests: 5
Failed requests: 0
Write errors: 0
Non-2xx responses: 5
Total transferred: 2590 bytes
HTML transferred: 0 bytes
Requests per second: 0.13 [#/sec] (mean)
Time per request: 15218.750 [ms] (mean)
Time per request: 7609.375 [ms] (mean, across all concurrent requests)
Transfer rate: 0.07 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 8547 13853 4524.6 14750 20047
Waiting: 8516 13828 4538.6 14703 20047
Total: 8547 13853 4524.6 14750 20047
Percentage of the requests served within a certain time (ms)
50% 12938
66% 16563
75% 16563
80% 20047
90% 20047
95% 20047
98% 20047
99% 20047
100% 20047 (longest request)
C:\Program Files\Apache Software Foundation\Apache2.2\bin>
オプションの説明・テスト結果の見方については 「 @IT:Apacheパフォーマンス・チューニングのポイント(2/2) 」 をご参照下さい。
チェックについては主に以下を確認すればOKみたいです。
- リクエストの成否(Complete requestsとFailed requests)
- 1秒間に処理されたリクエスト数(Requests per second)
- 接続時間・処理時間・待ち時間の内訳(Connect/Processing/Waiting)
でも、しばらくサーバをかまって再び同じベンチマークテストをしたら、今度はとっても調子がいい。 上と同じテスト↓↓
C:\Program Files\Apache Software Foundation\Apache2.2\bin>ab -n 5 -c 2 http://192.168.11.3/wordpress/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.11.3 (be patient).....done
Server Software: Apache
Server Hostname: 192.168.11.3
Server Port: 80
Document Path: /wordress/index.php
Document Length: 216 bytes
Concurrency Level: 2
Time taken for tests: 0.031 seconds
Complete requests: 5
Failed requests: 0
Write errors: 0
Non-2xx responses: 5
Total transferred: 2015 bytes
HTML transferred: 1080 bytes
Requests per second: 160.00 [#/sec] (mean)
Time per request: 12.500 [ms] (mean)
Time per request: 6.250 [ms] (mean, across all concurrent requests)
Transfer rate: 62.97 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 0 13 7.0 16 16
Waiting: 0 13 7.0 16 16
Total: 0 13 7.0 16 16
Percentage of the requests served within a certain time (ms)
50% 16
66% 16
75% 16
80% 16
90% 16
95% 16
98% 16
99% 16
100% 16 (longest request)
C:\Program Files\Apache Software Foundation\Apache2.2\bin>
ついでに、もっと負荷をかけてみた。 結果↓↓
C:\Program Files\Apache Software Foundation\Apache2.2\bin>ab -n 1000 -c 100 http://192.168.11.3/wordpress/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.11.3 (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 requests
Server Software: Apache
Server Hostname: 192.168.11.3
Server Port: 80
Document Path: /wordress/index.php
Document Length: 216 bytes
Concurrency Level: 100
Time taken for tests: 6.938 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Non-2xx responses: 1000
Total transferred: 403000 bytes
HTML transferred: 216000 bytes
Requests per second: 144.14 [#/sec] (mean)
Time per request: 693.750 [ms] (mean)
Time per request: 6.938 [ms] (mean, across all concurrent requests)
Transfer rate: 56.73 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 3.5 0 31
Processing: 219 660 117.3 672 1188
Waiting: 219 659 117.4 672 1188
Total: 219 660 116.9 672 1188
Percentage of the requests served within a certain time (ms)
50% 672
66% 672
75% 688
80% 688
90% 781
95% 828
98% 953
99% 1063
100% 1188 (longest request)
C:\Program Files\Apache Software Foundation\Apache2.2\bin>
非常にいい!?
いろいろサービスを再起動させたりしてたからかも!
とりあえず、パフォーマンスアップ作戦は保留しとこっと。 では、では。
Comments