简单的HTTP负载测试器
项目描述
Boom!是一个简单的命令行工具,可以向Web应用发送一些负载。
Boom!是一个脚本,您可以使用它快速进行Web应用部署的烟雾测试。如果您需要一个更复杂的工具,我建议您查看Funkload或Locust。
Boom!是专门编写来替代我的Apache Bench使用的,以提供一些AB中缺少的功能和修复一些我遇到的烦恼。
我对这个工具没有特别的野心,并且由于我没有在Python领域中找到类似这样的工具,所以我写了这个。
还有许多其他工具,如非常流行的Siege。
然而,Boom!是一个不错的选择,因为它可以在任何平台上运行,并且能够通过greenlets模拟成千上万的用户。
安装
Boom!需要Gevent和Requests。如果您在Windows下,我强烈建议您使用您在https://github.com/surfly/gevent/downloads找到的xxx-win32-py2.7.exe安装程序来安装Gevent。
Boom!应该与最新版本兼容。
如果您使用Linux,通常建议安装源代码版本。您需要libev来使用Gevent。
Ubuntu下的示例
$ sudo apt-get install libev libev-dev python-dev
然后
$ pip install boom
基本用法
基本用法示例:10个用户的最大并发量下的100个查询
$ boom http://localhost:80 -c 10 -n 100 Server Software: nginx/1.2.2 Running 100 queries - concurrency: 10. Starting the load [===================================] Done -------- Results -------- Successful calls 100 Total time 0.3260 s Average 0.0192 s Fastest 0.0094 s Slowest 0.0285 s Amplitude 0.0191 s RPS 306 BSI Pretty good -------- Legend -------- RPS: Request Per Second BSI: Boom Speed Index
Boom!有更多选项
$ 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
设计
Boom通过Gevent使用greenlets创建虚拟用户,并使用Requests进行查询。
使用greenlets允许Boom以极少的资源启动大量虚拟用户。启动1000个用户并用它们猛击Web应用不是问题。
如果您对这个项目感兴趣,欢迎加入https://github.com/tarekziade/boom的乐趣。
如果您的PR被合并,请确保将自己的名字添加到贡献者列表中。并且确保它按字母顺序排列!
历史
1.0 - 2016-09-05
更新.gitignore以适应PyCharm用户
为了简单起见(读作OCD),将贡献者列表按字母顺序排列
将“Hahahaha”的BSI响应替换为sadface
添加Travis CI
添加Coveralls
更新tox以在本地测试2.7和3.5(Travis CI处理其余部分)
0.9 - 2016-08-28
python 3支持
移除python 2.6支持
修复unittest2依赖项
添加–validator选项以验证请求响应数据
将–hook更改为–pre-hook
添加新的–post-hook选项以验证请求响应数据
修复失败的DNS解析的错误处理
将urlparse.urlparse替换为urllib3的parse_url
0.8 - 2013-07-14
更友好的进度条
添加–json-output选项
集成Tox
确保DNS解析在gevent 0.x和1.x中工作
改进测试
移除全局变量
0.7 - 2013-05-21
修复空统计时的TypeError - #19
捕获dns错误并以美观的方式显示
添加SSL支持 - #17
添加清晰的错误显示 - #16
早期版本没有备注。
所有者
Tarek Ziade
贡献者
Chris Adams
Rikard Anglerud
Lukasz Balcerzak
Ralph Bean
Andrea Crotti
Adolfo Fitoria
Tomas Hanacek
Hanley Hansen
Marcin Kuzminski
Jack Pearkes
王振璞
Venelin Stoykov
Martin Voldrich
项目详情
boom-1.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 947e271f34b27adaf38ed4fc10583c91bcc157ddd1fff9a067c3834b7889beb7 |
|
MD5 | 8135234eddc56547e89cc5da16e1b739 |
|
BLAKE2b-256 | e07fd80b633e7d06a4d03d14ef11b7a8155abf1c150d4b60de398e2060e9e79f |