负载测试工具

aioload的Python项目详细描述


build statuscoverage statuspypi package

艾洛德

使用aiosonichttp客户端加载测试工具。对于绘制图表,我们 使用matplotlib和pandas。

强烈推荐使用uvloop,它使我的速度提高了20%到25%。

要求

  • python=3.6

安装

pip install aioload
# optional, highly recommended
pip install uvloop

用法

您需要在诸如config.ini这样的设置文件中指定您的请求

[http]sock_read=30sock_connect=3[test]# target url for testurl=http://localhost:8080/api/v1/something# methods: get, post, put, deletemethod=post## use body for send body in request# if body is json, indicate correct header in headers section# comment body line if you're doing a get requestbody='{"foo": "bar"}'# query params if needed, this will transform url# in something like http://localhost:8080/api/v1/something?token=something[params]token=something# headers if needed[headers]content-type=application/json

用法示例

> aioload -h
usage: aioload [-h][-d][-v][-n NUMBER_OF_REQUESTS][-c CONCURRENCY][--plot]
               testfile

positional arguments:
  testfile              Test file to be executed

optional arguments:
  -h, --help            show this help message and exit
  -d, --debug           trueif present
  -v, --verbose         trueif present
  -n NUMBER_OF_REQUESTS, --number_of_requests NUMBER_OF_REQUESTS
                        number of requests to be done, default: 100
  -c CONCURRENCY, --concurrency CONCURRENCY
                        concurrency (requests at the same time), default: 10
  --plot                draw charts if present

> aioload config.ini -n 3000 -c 100 --plot -v
2019-05-29 17:20:51,662 - __init__:135 - info - 8cf56ded860f41d8a86dab2aed05218f - starting script... -
2019-05-29 17:20:55,301 - __init__:102 - info - 8cf56ded860f41d8a86dab2aed05218f - done - min=14.54ms;max=212.21ms;mean=109.36ms; req/s=600.0; req/q_std=333.7;stdev=24.65; codes.200=3000;concurrency=100;requests=3000;
./charts.jpg

可以重写aioload runner方法,here就是一个例子。然后您应该执行您生成的脚本,在本例中:python sample/dynamic_test.py conf.ini -v

python有限制,如果您的应用程序像thiscrystal server那样快得疯狂,那么测试将受到aiosonic客户端速度的限制。

贡献

  1. 叉子
  2. 创建分支feature/your_feature
  3. 提交-推-拉请求

依赖项通过pip-tools

谢谢:)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在数据库中存储工作日数据以及开始时间和结束时间?   mysql Java JPA内部联接查询不起作用   java MQ消息在不同的客户端应用程序中显示不同   javascript如何在xPage上提高typeAhead性能?   java在尝试保存EditText时无法暂停   mongodb“未能使用带参数的构造函数NO_构造函数实例化java.util.List”,   java如何修改使IllegalArgumentException:列“\u id”不存在的游标   转换Android。网Uri到Java。伊奥。输入流   java NetBeans RCP居中弹出窗口无法按预期工作   java将sql开发人员与netbeans连接起来   带有xmldsig签名的java JAXB编组   java ORACLE JDBC批处理执行不会返回受影响行的实际计数   java无法理解如何在由swagger自动生成的jaxrs服务器中访问请求头   java如何处理漏洞CVE20181258,同时将Spring安全版本5与外部客户端(最新版本)一起使用?   JavaSpring数据JPA存储库多租户单模式技术