abの基本認証
apachebenchで性能測定。テストサイトで実験的なことをしてから本番機で実装するんですが、テストサイトでの性能測定するときにabを使う。テストサイトは基本認証が効いているのでabでも基本認証を付けないといけない。manページを見ると、
NAME ab - Apache HTTP server benchmarking tool SYNOPSIS ab [ -A auth-username:password ] [ -b windowsize ] [ -c concur- rency ] [ -C cookie-name=value ] [ -d ] [ -e csv-file ] [ -f protocol ] [ -g gnuplot-file ] [ -h ] [ -H custom-header ] [ -i ] [ -k ] [ -n requests ] [ -p POST-file ] [ -P proxy-auth-user- name:password ] [ -q ] [ -r ] [ -s ] [ -S ] [ -t timelimit ] [ -T content-type ] [ -u PUT-file ] [ -v verbosity] [ -V ] [ -w ] [ -x <table>-attributes ] [ -X proxy[:port] ] [ -y <tr>-attributes ] [ -z <td>-attributes ] [ -Z ciphersuite ] [http[s]://]hostname[:port]/path SUMMARY ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impres- sion of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving. OPTIONS -A auth-username:password Supply BASIC Authentication credentials to the server. The username and password are separated by a single : and sent on the wire base64 encoded. The string is sent regardless of whether the server needs it (i.e., has sent an 401 authentication needed).
- Aにユーザ名とパスワードをコロンでつないで与えてやればいいようです。
ってことでやってみる。
# ab -A hoge:fuga -c 100 -n 100 http://www.example.com
ちなみに-Aのあとの空白はなくてもOK。
# ab -Ahoge:fuga -c 100 -n 100 http://www.example.com