h2loadはtatsuhiro_t氏によって公開されている、HTTP2・SPDY用のベンチマークツールである。
非常に有用なツールなので、実際に試してみた。
試した環境はUbuntu 13.10である。
必要な物をインストールする
ビルドに必要なパッケージをインストールする。
sudo apt-get install -y autoconf automake autotools-dev libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libevent-dev git
spdylayをビルドする
同氏によって開発されたspdy実装が必要であるので、合わせてビルドする。
git clone git clone https://github.com/tatsuhiro-t/spdylay.git cd ./spdylay autoreconf -i automake autoconf ./configure make sudo make install
nghttp2をビルドする
h2loadはnghttp2に同梱されているのでビルドする
git clone https://github.com/tatsuhiro-t/nghttp2.git cd ./nghttp2 autoreconf -i automake autoconf ./configure make
h2loadを試す
nghttp2/srcにh2loadが作成されている。
実際に以下の様なコマンドで、リクエストを生成できる。
- -n 総リクエスト数
- -c クライアント数
- -m クライアント当たりの、最大ストリーム並列数
yuki@nghttp2:~/nghttp2$ ./src/h2load -n 10000 -c 10 -m 10 https://192.168.0.55 starting benchmark... spawning thread #0: 10 concurrent clients, 10000 total requests progress: 10% done progress: 20% done progress: 30% done progress: 40% done progress: 50% done progress: 60% done progress: 70% done progress: 80% done progress: 90% done progress: 100% done finished in 4 sec, 778 millisec and 701 microsec, 2092 req/s, 1829 kbytes/s requests: 10000 total, 10000 started, 10000 done, 10000 succeeded, 0 failed, 0 errored status codes: 10000 2xx, 0 3xx, 0 4xx, 0 5xx traffic: 9110500 bytes total, 2830060 bytes headers, 6120000 bytes data