locust

Posting dynamic values in Locust

眉间皱痕 提交于 2019-12-11 10:33:25
问题 I have an application that I am trying to load test with Locust. If I know the parameters of a post in advance, I can add them to a post and that works fine: self.client.post("/Login", {"Username":"user", "Password":"a"}) The application uses a bunch of hidden fields that get sent when the page is posted interactively. The content of these fields is dynamic and assigned by the server at runtime to manage sessions etc. e.g. <input type="hidden" name="$$submitid" value="view:xid1:xid2:xid143

Where can I find locust logs?

徘徊边缘 提交于 2019-12-10 14:47:36
问题 I'm using locust to stress test our app. I'm getting errors because the POST call seems incorrect. Where can I see the logs for locust? I'd like to see what the post call looks like to see what's wrong. Here's my code in case someone can tell me what I'm doing wrong: from locust import HttpLocust, TaskSet, task json3 = """{"stack_name": "beenz-php-app-12", "disable_rollback": true, "template": "php", "timeout_mins": 60}""" class MyTaskSet(TaskSet): @task def send(self): response = self.client

Understanding locust summary result

旧巷老猫 提交于 2019-12-07 03:15:30
I have a problem to understanding the locust result as this is the first time load test my server, I ran locust using command line on 00:00 local time with; 1000 total user , 100 hatch per second and 10000 request. Below are the result Name # reqs # fails Avg Min Max | Median req/s -------------------------------------------------------------------------------------------------------------------------------------------- GET /api/v0/business/result/22918 452 203(30.99%) 9980 2830 49809 | 6500 1.70 GET /api/v0/business/result/36150 463 229(33.09%) 10636 2898 86221 | 7000 1.50 GET /api/v0

Web Service性能测试工具比较

不打扰是莪最后的温柔 提交于 2019-12-06 01:02:41
背景 希望选择一款Web Service性能测试工具,能真实模拟大量用户访问网站时的请求,从而获取服务器当前的请求处理能力(请求数/秒)。 以微信服务器为例,每个用户用独立的登录token,做各种操作,比如刷消息、发消息、看朋友圈等。 希望该性能测试工具符合如下要求: 测试脚本能力,最好是Python/Ruby等最常用的 每个并发实例能使用不同参数 CLI启动测试,这对自动化测试很重要 Session支持,也就是第一个请求的响应,能用于后续请求的参数。 单个结点的并发数量高。 分布式支持,不受限于单个结点的计算能力。 性能测试工具选手: Gatling http://gatling.io/ Gatling是一款基于Scala 开发的高性能服务器性能测试工具,它主要用于对服务器进行负载等测试,并分析和测量服务器的各种性能指标。Gatling主要用于测量基于HTTP的服务器,比如Web应用程序,RESTful服务等,除此之外它拥有以下特点: 支持Akka Actors 和 Async IO,从而能达到很高的性能 支持实时生成Html动态轻量报表,从而使报表更易阅读和进行数据分析 支持DSL脚本,从而使测试脚本更易开发与维护 支持录制并生成测试脚本,从而可以方便的生成测试脚本 支持导入HAR(Http Archive)并生成测试脚本 支持Maven,Eclipse,IntelliJ等

Python 负载测试工具 Locust

假装没事ソ 提交于 2019-12-05 04:31:09
Locust 是一个开源负载测试工具。使用 Python 代码定义用户行为,也可以仿真百万个用户。 Locust 是非常简单易用,分布式,用户负载测试工具。Locust 主要为网站或者其他系统进行负载测试,能测试出一个系统可以并发处理多少用户。 Locust 是完全基于时间的,因此单个机器支持几千个并发用户。相比其他许多事件驱动的应用,Locust 不使用回调,而是使用轻量级的处理方式 gevent 。 特性 使用纯 Python 代码编写用户测试场景 ;不需要 UIs 或者 XML 分布式&可伸缩 - 支持成千上万的用户 基于 Web 的 UI 可以测试任意系统; 虽然 Locust 是面向 Web 的,但是也可以测试其他任意的系统 安装: ? 1 >pip install locustio 示例代码: ? from locust import HttpLocust, TaskSet, task class WebsiteTasks(TaskSet): def on_start(self): self.client.post("/login", { "username": "test_user", "password": "" }) @task def index(self): self.client.get("/") @task def about(self): self

how to pass custom parameters to a locust test class?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 22:49:34
I'm currently passing custom parameters to my load test using environment variables. For example, my test class looks like this: from locust import HttpLocust, TaskSet, task import os class UserBehavior(TaskSet): @task(1) def login(self): test_dir = os.environ['BASE_DIR'] auth=tuple(open(test_dir + '/PASSWORD).read().rstrip().split(':')) self.client.request( 'GET', '/myendpoint', auth=auth ) class WebsiteUser(HttpLocust): task_set = UserBehavior Then I'm running my test with: locust -H https://myserver --no-web --clients=500 --hatch-rate=500 --num-request=15000 --print-stats --only-summary Is

Locust : How to make locust run for a specific amount of time

﹥>﹥吖頭↗ 提交于 2019-12-04 16:08:01
问题 official locustio documentation tells about how to write simple locust tasks which run indefinitely. Couldn't find out how to run load which lasts for a specific amount of time, so that the test will automatically stop after the specified interval. I dont need it from the web interface, command line/code option will be just great. 回答1: I recently started using locust myself and unfortunately locust 0.7.1 does not provide a way to terminate a test based on a length of time. It does however

Locust install on windows Locust 在win上安装 笔记

一世执手 提交于 2019-12-04 03:57:05
首先,安装python,2.7, Locust 需要的版本 ( Locust requires Python 2.6+ . It is not currently compatible with Python 3.x.) 然后把python配置到环境变量,再安装,pip。 python,pip安装如下: 1、在以下地址下载最新的PIP安装文件: http://pypi.python.org/pypi/pip#downloads 2、解压 3、进入解压目录 4、 python setup.py install 5、配置python脚本到环境变量 PATH最后添加: python路径\Scripts;如:(d:\python27\Scripts;) 使用pip安装 gevent ,在cmd命令行里 pip install gevent。 安装 gevent可能会遇到 GEVENT error: Microsoft Visual C 9.0 is required 先到 http://www.microsoft.com/en-us/download/details.aspx?id=44266 下载安装上,然后重新 pip install gevent 然后 pip install locustio,这样基本安装成功。 来源: oschina 链接: https://my.oschina

In locust How to get a response from one task and pass it to other task

淺唱寂寞╮ 提交于 2019-12-04 02:50:54
I have started using Locust to do performance test. I want to fire two post request to two different end points. But the second post request needs response of the first request. How to do this in convenient way. I have tried like below but not working. from locust import HttpLocust, TaskSet, task class GetDeliveryDateTasks(TaskSet): request_list = [] @task def get_estimated_delivery_date(self): self.client.headers['Content-Type'] = "application/json" response = self.client.post("/api/v1/estimated-delivery-date/", json= { "xx": "yy" } ) json_response_dict = response.json() request_id = json

Locust : How to make locust run for a specific amount of time

时光总嘲笑我的痴心妄想 提交于 2019-12-03 10:17:07
official locustio documentation tells about how to write simple locust tasks which run indefinitely. Couldn't find out how to run load which lasts for a specific amount of time, so that the test will automatically stop after the specified interval. I dont need it from the web interface, command line/code option will be just great. aztlan2k I recently started using locust myself and unfortunately locust 0.7.1 does not provide a way to terminate a test based on a length of time. It does however provide a way to terminate the test based on the number of requests that have been issued. If you run