ab コマンドを使えばベンチマークを取ることができます。以下のコマンドだと同時接続数10で100回アクセスすることができるんです。この記事はちょっとした覚え書きです。
1 | ab -c 10 -n 100 'http://example.com/' |
いまいち理解ができなかったのですが以下が参考になりました。
同時接続数を100、リクエスト数を10000とすれば、同時に100のリクエストが発生したときに、10000リクエストを処理するまでの性能が測定されるわけだ。
@IT:Apacheパフォーマンス・チューニングのポイント(2/2)
というわけでさっそく取ってみた結果がこちら。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | Server Software: Apache/2.2.3
Server Hostname: example.com
Server Port: 80
Document Path: /
Document Length: 22043 bytes
Concurrency Level: 10
Time taken for tests: 217.355 seconds
Complete requests: 100
Failed requests: 95
(Connect: 0, Receive: 0, Length: 95, Exceptions: 0)
Write errors: 0
Total transferred: 2236443 bytes
HTML transferred: 2204143 bytes
Requests per second: 0.46 [#/sec] (mean)
Time per request: 21735.505 [ms] (mean)
Time per request: 2173.551 [ms] (mean, across all concurrent requests)
Transfer rate: 10.05 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 1
Processing: 10526 20976 3287.1 21617 27821
Waiting: 10509 20963 3286.5 21606 27810
Total: 10527 20977 3287.2 21618 27822
Percentage of the requests served within a certain time (ms)
50% 21618
66% 22292
75% 22975
80% 23225
90% 24749
95% 26031
98% 27796
99% 27822
100% 27822 (longest request) |
いろいろとありますが、特に注目するべき点は Failed requests と Requests per second みたいです。Failed requests を0に、Requests per second をできるだけ大きくするようにチューニングをするべきのようです。
というわけでアプリ側とサーバー側をチューニングして以下のような結果に改善することができました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | Server Software: Apache/2.2.3
Server Hostname: example.com
Server Port: 80
Document Path: /
Document Length: 17926 bytes
Concurrency Level: 10
Time taken for tests: 12.682 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 1809700 bytes
HTML transferred: 1792600 bytes
Requests per second: 7.89 [#/sec] (mean)
Time per request: 1268.150 [ms] (mean)
Time per request: 126.815 [ms] (mean, across all concurrent requests)
Transfer rate: 139.36 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 2
Processing: 655 1251 99.4 1257 1436
Waiting: 652 1247 99.4 1253 1433
Total: 655 1251 99.4 1257 1437
Percentage of the requests served within a certain time (ms)
50% 1257
66% 1288
75% 1298
80% 1315
90% 1339
95% 1369
98% 1424
99% 1437
100% 1437 (longest request) |
ある程度使いこなせるようになってきたので今後サイトのパフォーマンスを向上させる際に使っていきたいと思います。

コメント