はじめに
Apache Bench
vはWebサーバをベンチマークするためのツールです。この記事では、Apache Bench
の簡単な使い方についてまとめます。
基本
ab
で利用します。ab -h
で使い方が確認できます。
1 | Usage: ab [options] [http[s]://]hostname[:port]/path |
具体的には以下のように使います。
1 | ab https://localhost:8000/ |
負荷をかける
負荷をかけたい場合はオプションを利用します。n
が総リクエスト数、c
が同時接続数を表します。n>=c
である必要があります。
1 | -n requests Number of requests to perform |
1 | ab -n 20 -c 4 https://localhost:8000/ |
フォームのPOST
以下のようなテキストファイルを用意します。(param.txt)
1 | username=hoge&password=fuga |
1 | ab -p param.txt -T "application/x-www-form-urlencoded" https://localhost:8000/login |
参考
http://lapis25.hatenablog.com/entry/20070208/1170929622
https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
記事情報
- 投稿日:2020年6月23日
- 最終更新日:2020年6月23日