以前のエントリを少々、拡張
cookie認証ページに apache bench (ab)コマンドで負荷(性能)test - end0tknrのkipple - web写経開発
HTTP GET
$ /home/endo/local/apache80/bin/ab \ -n 5000 \ -c 10 \ -v 2 \ -C "iPlanetDirectoryPro=<認証tokenなのでナイショ>; HTTP_havi-id=<ナイショ>" \ https://stress.test.hostname.example.com/
HTTP POST - ポイントは「-p」「-T」オプション
$ /home/endo/local/apache80/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 : -p postfile File containing data to POST. Remember also to set -T -T content-type Content-type header for POSTing, eg. 'application/x-www-form-urlencoded' Default is 'text/plain' :
ヘルプによれば、上記の通りなので、次のコマンドラインでOK
$ /home/endo/local/apache80/bin/ab \ -n 1000 \ -c 10 \ -v 2 \ -p /home/endo/tmp/postdata.file \ -T "application/x-www-form-urlencoded" \ -C "iPlanetDirectoryPro=<認証tokenなのでナイショ>; HTTP_havi-id=<ナイショ>" \ https://stress.test.hostname.example.com/
参考までに「/home/endo/tmp/postdata.file」の内容は次の通り
$ cat /home/endo/tmp/postdata.file year=2015&month=12