end0tknr's kipple - web写経開発


cookie認証ページに apache bench (ab)コマンドで負荷(性能)test

STEP1/3 - helpを読みましょう


$ /home/endo/local/apache22/bin/ab -h
Usage: ab [options] [http://]hostname[:port]/path
Options are:
    -n requests     Number of requests to perform
    -c concurrency  Number of multiple requests to make
    -t timelimit    Seconds to max. wait for responses
    -b windowsize   Size of TCP send/receive buffer, in bytes
    -p postfile     File containing data to POST. Remember also to set -T
    -u putfile      File containing data to PUT. Remember also to set -T
    -T content-type Content-type header for POSTing, eg.
                    Default is 'text/plain'
    -v verbosity    How much troubleshooting info to print
    -w              Print out results in HTML tables
    -i              Use HEAD instead of GET
    -x attributes   String to insert as table attributes
    -y attributes   String to insert as tr attributes
    -z attributes   String to insert as td or th attributes
    -C attribute    Add cookie, eg. 'Apache=1234. (repeatable)
    -H attribute    Add Arbitrary header line, eg. 'Accept-Encoding: gzip'
                    Inserted after all normal header lines. (repeatable)
    -A attribute    Add Basic WWW Authentication, the attributes
                    are a colon separated username and password.
    -P attribute    Add Basic Proxy Authentication, the attributes
                    are a colon separated username and password.
    -X proxy:port   Proxyserver and port number to use
    -V              Print version number and exit
    -k              Use HTTP KeepAlive feature
    -d              Do not show percentiles served table.
    -S              Do not show confidence estimators and warnings.
    -g filename     Output collected data to gnuplot format file.
    -e filename     Output CSV file with percentages served
    -r              Don't exit on socket receive errors.
    -h              Display usage information (this message)

STEP2/3 - ブラウザで OpenAMにログインし、cookie tokenをcopy



STEP3/3 - 試しにrequest数=100 , concurrency=10 で

$ /home/endo/local/apache22/bin/ab \
  -v 4 \
  -n 100 \
  -c 10 \
  -C "iPlanetDirectoryPro=AQIC5wM2LY4SfcwvJoNsp46OC1i0zSffynvwSD7PaQZnrjY.*AAJTSQACMDEAAlNLABMxMDQ4MzI5ODg4NDE1NTU2NTE2*" \
LOG: Response code = 200

Server Software:        Apache/2.2.29
Server Hostname:        cent6.a5.jp
Server Port:            80

Document Path:          /
Document Length:        29593 bytes

Concurrency Level:      10
Time taken for tests:   21.965 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      3072500 bytes
HTML transferred:       2959300 bytes
Requests per second:    4.55 [#/sec] (mean)
Time per request:       2196.491 [ms] (mean)
Time per request:       219.649 [ms] (mean, across all concurrent requests)
Transfer rate:          136.60 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.2      0       1
Processing:   679 2171 1636.1   1529    7465
Waiting:      679 2170 1636.2   1529    7464
Total:        679 2171 1636.2   1529    7465

Percentage of the requests served within a certain time (ms)
  50%   1529
  66%   1577
  75%   1613
  80%   2055
  90%   4447
  95%   7292
  98%   7417
  99%   7465
 100%   7465 (longest request)