Boom! - abに代わるWebサイト負荷テストツール
Webサイトの負荷テストを行う際によく使われるツールがApache Bench(通称ab)ですが、その代替になるかも知れないソフトウェアがBoom!です。
インストールはpipだけでできます。ただし他にlibeventも必要です。
$ pip install boom
使い方としてはabと殆ど変わらないように見えます。基本的には以下のようなコマンドです。
$ boom http://localhost:80 -c 10 -n 100
例えばMOONGIFTを実行すると次のようになります。
その他のオプションは次のようになっています。
$ boom --help
usage: boom [-h] [--version] [-m {GET,POST,DELETE,PUT,HEAD,OPTIONS}]
[--content-type CONTENT_TYPE] [-D DATA] [-c CONCURRENCY] [-a AUTH]
[--header HEADER] [--pre-hook PRE_HOOK] [--post-hook POST_HOOK]
[--json-output] [-n REQUESTS | -d DURATION]
[url]
Simple HTTP Load runner.
positional arguments:
url URL to hit
optional arguments:
-h, --help show this help message and exit
--version Displays version and exits.
-m {GET,POST,DELETE,PUT,HEAD,OPTIONS}, --method {GET,POST,DELETE,PUT,HEAD,OPTIONS}
HTTP Method
--content-type CONTENT_TYPE
Content-Type
-D DATA, --data DATA Data. Prefixed by "py:" to point a python callable.
-c CONCURRENCY, --concurrency CONCURRENCY
Concurrency
-a AUTH, --auth AUTH Basic authentication user:password
--header HEADER Custom header. name:value
--pre-hook PRE_HOOK Python module path (eg: mymodule.pre_hook) to a
callable which will be executed before doing a request
for example: pre_hook(method, url, options). It must
return a tupple of parameters given in function
definition
--post-hook POST_HOOK
Python module path (eg: mymodule.post_hook) to a
callable which will be executed after a request is
done for example: eg. post_hook(response). It must
return a given response parameter or raise an
`boom._boom.RequestException` for failed request.
--json-output Prints the results in JSON instead of the default
format
-n REQUESTS, --requests REQUESTS
Number of requests
-d DURATION, --duration DURATION
Duration in seconds
特徴的なのはpre-hookとpost-hookかも知れません。Pythonのモジュールパスを指定することで、実行前と実行後に別なメソッドを呼べるようになります。そこでプログラムを組んでパラメータを変更したり、結果をDBに保存したりと言ったことができそうです。システムテストを自動化する上での使い方ができそうです。 Boom!はPython製のオープンソース・ソフトウェア(Apache License 2.0)です。 tarekziade/boom