http_load 使い方

http_load

http_load

webサーバ負荷テスト用ツールです。

自分メモのため、使い方を書いておきます。

1.インストール
$ wget http://www.acme.com/software/http_load/http_load-09Mar2016.tar.gz
$ tar xvfz  http_load-09Mar2016.tar.gz
$ cd http_load-09Mar2016
$ make
$ make install
↓ここで問題が起きる
rm -f /usr/local/bin/http_load
cp http_load /usr/local/bin
rm -f /usr/local/man/man1/http_load.1
cp http_load.1 /usr/local/man/man1
cp: cannot create regular file `/usr/local/man/man1': そのようなファイルやディレクトリはありません
make: *** [install] エラー 1

→解決策 mkdir -p /usr/local/man/man1

これでhttpの負荷テストが出来るようになります! 例:

urlリストを作製して
$ vim urls.txt
http:hoge.com

//5アクセス/秒、10秒アクセス
http_load -rate 5 -seconds 10 urls.txt

httpsもテストしたい場合ちょっと複雑 Makefileファイルを改修する必要がある

$ cd http_load-09Mar2016
$ vim Makefile

#SSL_TREE =     /usr/local/ssl ← opensslのパスに変更[/usr/local/opt/openssl]
#SSL_DEFS =     -DUSE_SSL
#SSL_INC =      -I$(SSL_TREE)/include
#SSL_LIBS =     -L$(SSL_TREE)/lib -lssl -lcrypto
//上記のコメントアウト部分を外す
$ make
↓今回はまたトラブル
'openssl/ssl.h' file not found が出る

↓解決
僕はhomebrewを使ってopensslをインストール
$ brew list
$ brew link openssl --force これだけでは足りないので

.bash_profileに以下のpathを追加する
export PATH=/usr/local/opt/openssl/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/opt/openssl/lib:$LD_LIBRARY_PATH
export CPATH=/usr/local/opt/openssl/include:$LD_LIBRARY_PATH

$ make
$ make install

多分問題なく通ると思う! さあ!httpsの負荷テストガンガンやりましょう!!