目次

06 AB テスト

http://qiita.com/flexfirm/items/ac5a2f53cfa933a37192

$ ab -n 100 -c 100 http://www.example.co.jp/
-n 数値リクエストの総数を数値で指定
-c 数値同時に発行するリクエストの数を数値で指定

実行例

$ ab -n 100 -c 20 http://fl8.jp/
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 fl8.jp (be patient).....done


Server Software:        Apache/2.2.15
Server Hostname:        fl8.jp
Server Port:            80

Document Path:          /
Document Length:        25 bytes

Concurrency Level:      20
Time taken for tests:   1.027 seconds
Complete requests:      100
Failed requests:        68
   (Connect: 0, Receive: 0, Length: 68, Exceptions: 0)
Write errors:           0
Non-2xx responses:      68
Total transferred:      63053 bytes
HTML transferred:       41965 bytes
Requests per second:    97.33 [#/sec] (mean)
Time per request:       205.482 [ms] (mean)
Time per request:       10.274 [ms] (mean, across all concurrent requests)
Transfer rate:          59.93 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        8    8   0.1      8       8
Processing:    17  177 206.1     48     586
Waiting:       17  160 180.7     47     508
Total:         25  185 206.1     56     594

Percentage of the requests served within a certain time (ms)
  50%     56
  66%     86
  75%    432
  80%    451
  90%    520
  95%    541
  98%    585
  99%    594
 100%    594 (longest request)

この辺確認

Time taken for tests:   1.027 seconds
Requests per second:    97.33 [#/sec] (mean)
Total:         25  185 206.1     56     594

結果の意味

Time taken for testsテストに要した時間(数値が低いほど良い)
Requests per second1秒で処理できるリクエスト数(数値が高いほど良い)
Connection Times (ms)リクエストに要した時間(ミリ秒)の内訳。
Connect接続確立までにかかった時間です
Waiting接続確立からクライアントがレスポンスを受け取るまでにかかった時間です。
Processing対象サーバ側での処理時間です。アプリケーションで行う処理が複雑なときは、この値が大きくなる傾向があります