Locust no-web 模式与参数详解
读前参考:《性能测试工具Locust 》
熟悉 Apache ab 工具的同学都知道,它是没有界面的,通过命令行执行。 Locust 同样也提供的命令行运行,好处就是更节省客户端资源。
命令行运行 Locust 测试
以上一节的 baidu 首页测试(load_test.py)为例 通过 no-web 模式运行测试。
> locust -f load_test.py --host=https://www.baidu.com --no-web -c 10 -r 2 -t 1m [2017-10-30 22:17:30,292] DESKTOP-SMGQBBM/INFO/locust.main: Run time limit set to 60 seconds
[2017-10-30 22:17:30,302] DESKTOP-SMGQBBM/INFO/locust.main: Starting Locust 0.8
[2017-10-30 22:17:30,302] DESKTOP-SMGQBBM/INFO/locust.runners: Hatching and swarming 10 clients at the rate 2 clients/s...
Name # reqs # fails Avg Min Max | Median req/s .... [2017-10-30 22:18:30,301] DESKTOP-SMGQBBM/INFO/locust.main: Time limit reached. Stopping Locust.
[2017-10-30 22:18:30,302] DESKTOP-SMGQBBM/INFO/locust.main: Shutting down (exit code 0), bye.
Name # reqs # fails Avg Min Max | Median req/s
--------------------------------------------------------------------------------------------------------------------------------------------
GET / 117 0(0.00%) 31 17 96 | 28 2.10
--------------------------------------------------------------------------------------------------------------------------------------------
Total 117 0(0.00%) 2.10 Percentage of the requests completed within given times
Name # reqs 50% 66% 75% 80% 90% 95% 98% 99% 100%
--------------------------------------------------------------------------------------------------------------------------------------------
GET / 117 28 30 36 37 49 62 69 72 96
--------------------------------------------------------------------------------------------------------------------------------------------
Total 117 28 30 36 37 49 62 69 72 96
启动参数:
–no-web 表示不使用Web界面运行测试。
-c 设置虚拟用户数。
-r 设置每秒启动虚拟用户数。
-t 设置设置运行时间。
Locust 参数
打开命令提示符(或Linux终端),输入 locust --help 。
> locust --help
Usage: locust [options] [LocustClass [LocustClass2 ... ]] Options:
-h, --help show this help message and exit
-H HOST, --host=HOST Host to load test in the following format:
http://10.21.32.33
--web-host=WEB_HOST Host to bind the web interface to. Defaults to '' (all
interfaces)
-P PORT, --port=PORT, --web-port=PORT
Port on which to run web host
-f LOCUSTFILE, --locustfile=LOCUSTFILE
Python module file to import, e.g. '../other.py'.
Default: locustfile
--csv=CSVFILEBASE, --csv-base-name=CSVFILEBASE
Store current request stats to files in CSV format.
--master Set locust to run in distributed mode with this
process as master
--slave Set locust to run in distributed mode with this
process as slave
--master-host=MASTER_HOST
Host or IP address of locust master for distributed
load testing. Only used when running with --slave.
Defaults to 127.0.0.1.
--master-port=MASTER_PORT
The port to connect to that is used by the locust
master for distributed load testing. Only used when
running with --slave. Defaults to 5557. Note that
slaves will also connect to the master node on this
port + 1.
--master-bind-host=MASTER_BIND_HOST
Interfaces (hostname, ip) that locust master should
bind to. Only used when running with --master.
Defaults to * (all available interfaces).
--master-bind-port=MASTER_BIND_PORT
Port that locust master should bind to. Only used when
running with --master. Defaults to 5557. Note that
Locust will also use this port + 1, so by default the
master node will bind to 5557 and 5558.
--expect-slaves=EXPECT_SLAVES
How many slaves master should expect to connect before
starting the test (only when --no-web used).
--no-web Disable the web interface, and instead start running
the test immediately. Requires -c and -r to be
specified.
-c NUM_CLIENTS, --clients=NUM_CLIENTS
Number of concurrent Locust users. Only used together
with --no-web
-r HATCH_RATE, --hatch-rate=HATCH_RATE
The rate per second in which clients are spawned. Only
used together with --no-web
-t RUN_TIME, --run-time=RUN_TIME
Stop after the specified amount of time, e.g. (300s,
20m, 3h, 1h30m, etc.). Only used together with --no-
web
-L LOGLEVEL, --loglevel=LOGLEVEL
Choose between DEBUG/INFO/WARNING/ERROR/CRITICAL.
Default is INFO.
--logfile=LOGFILE Path to log file. If not set, log will go to
stdout/stderr
--print-stats Print stats in the console
--only-summary Only print the summary stats
--no-reset-stats Do not reset statistics once hatching has been
completed
-l, --list Show list of possible locust classes and exit
--show-task-ratio print table of the locust classes' task execution
ratio
--show-task-ratio-json
print json data of the locust classes' task execution
ratio
-V, --version show program's version number and exit
参数说明:
| 参数 | 说明 |
|---|---|
| -h, –help | 查看帮助 |
| -H HOST, –host=HOST | 指定被测试的主机,采用以格式:http://10.21.32.33 |
| –web-host=WEB_HOST | 指定运行 Locust Web 页面的主机,默认为空 “。 |
| -P PORT, –port=PORT, –web-port=PORT | 指定 –web-host 的端口,默认是8089 |
| -f LOCUSTFILE, –locustfile=LOCUSTFILE | 指定运行 Locust 性能测试文件,默认为: locustfile.py |
| –csv=CSVFILEBASE, –csv-base-name=CSVFILEBASE | 以CSV格式存储当前请求测试数据。 |
| –master | Locust 分布式模式使用,当前节点为 master 节点。 |
| –slave | Locust 分布式模式使用,当前节点为 slave 节点。 |
| –master-host=MASTER_HOST | 分布式模式运行,设置 master 节点的主机或 IP 地址,只在与 –slave 节点一起运行时使用,默认为:127.0.0.1. |
| –master-port=MASTER_PORT | 分布式模式运行, 设置 master 节点的端口号,只在与 –slave 节点一起运行时使用,默认为:5557。注意,slave 节点也将连接到这个端口+1 上的 master 节点。 |
| –master-bind-host=MASTER_BIND_HOST | Interfaces (hostname, ip) that locust master should bind to. Only used when running with –master. Defaults to * (all available interfaces). |
| –master-bind-port=MASTER_BIND_PORT | Port that locust master should bind to. Only used when running with –master. Defaults to 5557. Note that Locust will also use this port + 1, so by default the master node will bind to 5557 and 5558. |
| –expect-slaves=EXPECT_SLAVES | How many slaves master should expect to connect before starting the test (only when –no-web used). |
| –no-web | no-web 模式运行测试,需要 -c 和 -r 配合使用. |
| -c NUM_CLIENTS, –clients=NUM_CLIENTS | 指定并发用户数,作用于 –no-web 模式。 |
| -r HATCH_RATE, –hatch-rate=HATCH_RATE | 指定每秒启动的用户数,作用于 –no-web 模式。 |
| -t RUN_TIME, –run-time=RUN_TIME | 设置运行时间, 例如: (300s, 20m, 3h, 1h30m). 作用于 –no-web 模式。 |
| -L LOGLEVEL, –loglevel=LOGLEVEL | 选择 log 级别(DEBUG/INFO/WARNING/ERROR/CRITICAL). 默认是 INFO. |
| –logfile=LOGFILE | 日志文件路径。如果没有设置,日志将去 stdout/stderr |
| –print-stats | 在控制台中打印数据 |
| –only-summary | 只打印摘要统计 |
| –no-reset-stats | Do not reset statistics once hatching has been completed。 |
| -l, –list | 显示测试类, 配置 -f 参数使用 |
| –show-task-ratio | 打印 locust 测试类的任务执行比例,配合 -f 参数使用. |
| –show-task-ratio-json | 以 json 格式打印 locust 测试类的任务执行比例,配合 -f 参数使用. |
| -V, –version | 查看当前 Locust 工具的版本. |
个别参数,我没用过,也太清楚其含义,暂时就不翻译了。
Locust no-web 模式与参数详解的更多相关文章
- Tomcat web.xml配置参数详解
Apache Tomcat Configuration Reference - The Context Containerhttps://tomcat.apache.org/tomcat-5.5-do ...
- Locust性能测试6-命令行参数详解
前言 当我们在linux上使用locust工具压测的时候,会使用no-web模式,然后需要收集运行的日志,方便查找问题. 命令行参数 输入locust --help 查看所有的命令行参数 > l ...
- Web.xml配置参数详解
1 定义头和根元素 部署描述符文件就像所有XML文件一样,必须以一个XML头开始.这个头声明可以使用的XML版本并给出文件的字符编码.DOCYTPE声明必须立即出现在此头之后.这个声明告诉服务器适用的 ...
- rsync的介绍及参数详解,配置步骤,工作模式介绍
rsync的介绍及参数详解,配置步骤,工作模式介绍 rsync是类unix系统下的数据镜像备份工具.它是快速增量备份.全量备份工具. Sync可以远程同步,支持本地复制,或者与其他SSH.rsync主 ...
- [置顶]
MVC输出缓存(OutputCache参数详解)
1.学习之前你应该知道这些 几乎每个项目都会用到缓存,这是必然的.以前在学校时做的网站基本上的一个标准就是1.搞定增删改查2.页面做的不要太差3.能运行(ps真的有这种情况,答辩验收的时候几个人在讲台 ...
- Spark参数详解 一(Spark1.6)
Spark参数详解 (Spark1.6) 参考文档:Spark官网 在Spark的web UI在"Environment"选项卡中列出Spark属性.这是一个很有用的地方,可以检查 ...
- MVC输出缓存(OutputCache参数详解)
版权声明:本文为博主原创文章,未经博主允许转载随意. https://blog.csdn.net/kebi007/article/details/59199115 1.学习之前你应该知道这些 几乎每个 ...
- Nginx核心配置文件常用参数详解
Nginx核心配置文件常用参数详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 关于Nginx权威文档的话童鞋们可以参考Nginx官方文档介绍:http://nginx.org/ ...
- [spark]-Spark2.x集群搭建与参数详解
在前面的Spark发展历程和基本概念中介绍了Spark的一些基本概念,熟悉了这些基本概念对于集群的搭建是很有必要的.我们可以了解到每个参数配置的作用是什么.这里将详细介绍Spark集群搭建以及xml参 ...
随机推荐
- 基于ESXI6.5的服务器基本配置(HP DL388 Gen 9)
最近一段时间由于做毕业设计的原因,一直处于忙碌状态,刚做完毕业设计,导师处于项目的原因,买了一台惠普服务器(人民币1.7万),服务器自带的内存仅有16 G,硬盘也就只有600G,而且磁盘还做了raid ...
- WebVR认识
什么是WebVR WebVR是一种开放标准,可以在浏览器中体验VR,目标是让每个人都能轻松进入虚拟现实体验.
- Cracking the Coding Interview 题目分析笔记—— Array and String
1.Determine if a string has all unique characters learn: 为了减少空间利用率,其比较优秀的算法一般都适用位操作 返回值的命名方法,我们需要学习 ...
- Spring+SpringMVC+MyBatis+easyUI整合进阶篇(十一)redis密码设置、安全设置
警惕 前一篇文章<Spring+SpringMVC+MyBatis+easyUI整合进阶篇(九)Linux下安装redis及redis的常用命令和操作>主要是一个简单的介绍,针对redis ...
- TensorFlow 处理图片
目标:介绍如何对图像数据进行预处理使训练得到的神经网络模型尽可能小地被无关因素所影响.但与此同时,复杂的预处理过程可能导致训练效率的下降.为了减少预处理对于训练速度的影响,TensorFlow 提供了 ...
- FastDFS教程IV-文件服务器集群搭建
1.简介 本文主要介绍FastDFS文件服务器的集群搭建,在阅读本文之前,您需具备FastDFS文件服务器单节点安装,扩容,迁移等方面的知识.同时,您还需了解Keepalived,nginx方 ...
- Akka(43): Http:SSE-Server Sent Event - 服务端主推消息
因为我了解Akka-http的主要目的不是为了有关Web-Server的编程,而是想实现一套系统集成的api,所以也需要考虑由服务端主动向客户端发送指令的应用场景.比如一个零售店管理平台的服务端在完成 ...
- NOIP2017普及组解题报告
刚参加完NOIP2017普及,只考了210,于是心生不爽,写下了这篇解题报告...(逃 第一次写博,望dalao们多多指导啊(膜 第一题score,学完helloworld的人也应该都会吧,之前好多人 ...
- Solr中Field常用属性
FieldType 实例:<fieldType name="text_ik" class="solr.TextField"></fieldTy ...
- WINDOWS java 不能正常卸载 问题, (其他系统问题 也可以试试)
1.JAVA 原安装包无法卸载 不知道 有没有通知 碰到过这种情况的 自己碰到过3次这种情况了, 卸载不掉, 在网上 找了N多中 方法, 注册表什么的都被翻烂了, 单还是没用,其中有一次还把 ...