探索

接口压测之Locust

字号+ 作者:年深日久网 来源:时尚 2024-04-28 16:24:11 我要评论(0)

Command lineConfigfileDescription中文对照-f, --locustfilelocustfilePython module file to import,e.g. ‘ht

接口压测之Locust

Command line

Configfile

Description

中文对照

-f,接口 --locustfile

locustfile

Python module file to import,

e.g. ‘https://blog.csdn.net/qq_39286830/article/other.py’. Default: locustfile

需要执行脚本的文件及路径

-H, --host

host

Host to load test in the following

format: http://10.21.32.33

压测主机的host

-u, --users

users

Number of concurrent Locust users.

Only used together with –headless

压测并发用户数,

只能与-headless参数一起使用

-r, --hatch-rate

hatch-rate

The rate per second in which users are spawned.

Only used together with –headless

每秒启动用户数,

仅与–headless一起使用

-t, --run-time

run-time

Stop after the specified amount of time,

e.g. (300s, 20m, 3h, 1h30m, etc.).

Only used together with –headless

压测执行时间,

仅与–headless一起使用

--web-host

web-host

Host to bind the web interface to.

Defaults to ‘*’ (all interfaces)

网页上执行压测的host,

默认为

*

--web-port, -P

web-port

Port on which to run web host

网页上执行压测的端口

--headless

headless

Disable the web interface,

and instead start the load test immediately.

Requires -u and -t to be specified.

不支持网页压测,需要指定

-u,-t参数一起使用

--web-auth

web-auth

Turn on Basic Auth for the web interface.

Should be supplied in the following

format: username:password

网页执行压测认证,

格式为:username:password

--tls-cert

tls-cert

Optional path to TLS certificate to

use to serve over HTTPS

通过HTTPS服务的TLS证书的路径

--tls-key

tls-key

Optional path to TLS private key to

use to serve over HTTPS

通过HTTPS服务的TLS私钥的路径

--master

master

Set locust to run in distributed mode

with this process as master

分布式运行的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进程运行的host,

默认为*,只能与-master一起使用

--master-bind-port

master-bind-port

Port that locust master should bind to.

Only used when running with –master.

Defaults to 5557

master进程运行的端口,

默认为5557,只能与-master一起使用

--expect-workers

expect-workers

How many workers master should expect

to connect before starting the test

(only when –headless used).

分布式压测的slave个数,

只能与–headless参数一起使用

--worker

worker

Set locust to run in distributed mode

with this process as worker

slave压测进程

--master-host

master-host

Host or IP address of locust master for

distributed load testing.

Only used when running

with –worker. Defaults to 127.0.0.1.

salve压测进程配置的master进程的host,

只能与-worker一起使用

--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

–worker. Defaults to 5557.

salve压测进程配置的master进程的端口,

默认为5557,只能与-worker一起使用

-T, --tags

tags

List of tags to include in the test,

so only tasks with any matching tags will be executed

需要被执行的标签

-E, --exclude-tags

exclude-tags

List of tags to exclude from the test,

so only tasks with no matching tags will be executed

需要被过滤的标签

--csv

csv

Store current request stats to files in CSV format.

Setting this option will generate three files:

[CSV_PREFIX]_stats.csv,

[CSV_PREFIX]_stats_history.csv ,

[CSV_PREFIX]_failures.csv

将请求的统计数据存到csv文件里,

该参数会保存三个csv文件

--csv-full-history

csv-full-history

Store each stats entry in CSV

format to _stats_history.csv file

将每个统计条目存

到 _stats_history.csv 文件

--print-stats

print-stats

Print stats in the console

在控制台中打印统计信息

--only-summary

only-summary

Only print the summary stats

只打印汇总统计

--reset-stats

reset-stats

Reset statistics once hatching has been completed.

should be set on both master and workers

when running in distributed mode

重置统计信息,master和slave

同时设置才生效

--skip-log-setup

skip-log-setup

Disable Locust’s logging setup. Instead,

the configuration is provided by the

Locust test or Python defaults.

禁用日志

--loglevel, -L

loglevel

Choose between

DEBUG/INFO/WARNING/ERROR/CRITICAL.

Default is INFO.

记录日志级别,默认info

--logfile

logfile

Path to log file. If not set, log will go to stdout/stderr

日志记录目录,默认在/stdout/stderr

--step-load

step-load

Enable Step Load mode to monitor how performance

metrics varies when user load increases.

Requires –step-users and –step-time to be specified.

分布式压测逐步增加模式

--step-users

step-users

User count to increase by step in Step Load mode.

Only used together with –step-load

逐步增加的用户数,

只能和--step-load参数使用

--step-time

step-time

Step duration in Step Load mode,

e.g. (300s, 20m, 3h, 1h30m, etc.).

Only used together with –step-load

逐步增加的压测时长,

只能和--step-load参数使用

--exit-code-on-error

exit-code-on-error

Sets the process exit code to use

when a test result contain any failure or error

配置退出执行标签,

当程序执行出错包含这个标签时

-s, --stop-timeout

stop-timeout

Number of seconds to wait for a simulated

user to complete any executing task before exiting.

Default is to terminate immediately.

This parameter only needs to be specified for the

master process when running Locust distributed.

设置等待模拟用户完成任务时间,

默认立即退出

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • 造梦西游3唐僧技能搭配最好_造梦西游3唐僧技能学什么最好

    造梦西游3唐僧技能搭配最好_造梦西游3唐僧技能学什么最好

    2024-04-28 14:57

  • 真正有本事的人,都是“熬出来”的

    真正有本事的人,都是“熬出来”的

    2024-04-28 14:35

  • 白天

    白天

    2024-04-28 14:31

  • 普通又有点高级感的情绪文案1

    普通又有点高级感的情绪文案1

    2024-04-28 14:28

网友点评