ABコマンド(Apache Bench)を試してみる
WEBサーバーの性能測定を行いたいと思い、ひさびさにABコマンドを使ってみることにしました。
久しぶりに使うとなんだったか忘れてしまいますね。
基本的には下記の記述になります。
1 |
ab -n <総リクエスト数> -c <同時リクエスト数> <URL> |
例えば、100ユーザがhttp://exampleに10リクエストを発行した場合を想定。
1 |
ab -n 1000 -c 100 http://example/ |
・結果
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 |
Server Software: nginx : WEBサーバーのソフト名 Server Hostname: <ホスト名> :サーバーホスト名 Server Port: 80:サーバーのポート番号 Document Path: / : ドキュメントパス Document Length: 27411 bytes : ドキュメント容量 Concurrency Level: 100 Time taken for tests: 8.418 seconds Complete requests: 1000 :リクエストの成功回数 Failed requests: 0 : リクエストの失敗回数 Total transferred: 27771000 bytes HTML transferred: 27411000 bytes Requests per second: 118.79 [#/sec] (mean) : 1秒間で処理されたリクエスト数 Time per request: 841.816 [ms] (mean) Time per request: 8.418 [ms] (mean, across all concurrent requests) Transfer rate: 3221.62 [Kbytes/sec] received:1秒間で受信したデータ数 Connection Times (ms) min mean[+/-sd] median max Connect: 0 2 8.2 0 65 Processing: 104 811 124.2 824 1084 Waiting: 39 810 124.6 824 1084 Total: 113 812 124.2 824 1107 : 合計でどれくらいかかったかの時間 Percentage of the requests served within a certain time (ms) 50% 824 : 50%リクエストが0.824秒以内に返ってくる 66% 847 75% 860 80% 869 90% 901 95% 964 98% 1013 99% 1034 100% 1107 (longest request) |
で、何がいいんだか悪いんだか分らん…いろいろと見比べながら…
目次
Time taken for tests
試験にかかった時間。数値が低いのが良い
Failed requests
処理に失敗したリクエストの数。数値がひくのが良い。基本0で考えるのかな
Requests per second
1秒で処理できるリクエスト数。数値が高い方が良い
Time per request
1リクエストにつき処理に要した時間。数値が低い方が良い
Transfer rate
1秒間で受け取ったデータの大きさ。数値が高い方が良い
Connection Times (ms)
数値が低いほうが良い
Percentage of the requests served within a certain time (ms)
リクエストを完了するにかかっている時間なので数値が低いほうが良い。
ってな感じです。わかったようなわからないような…