locust no-web模式

> locust -f chat_zy.py --host=http://192.168.x.y:8810 --no-web -c 5 -r 2 --run-time 1m
[2019-09-26 11:12:02,439] DESKTOP-O2OE0LP/INFO/locust.main: Run time limit set to 60 seconds
[2019-09-26 11:12:02,439] DESKTOP-O2OE0LP/INFO/locust.main: Starting Locust 0.11.0
[2019-09-26 11:12:02,439] DESKTOP-O2OE0LP/INFO/locust.runners: Hatching and swarming 5 clients at the rate 2 clients/s...
 Name                                                          # reqs      # fails     Avg     Min     Max  |  Median   req/s
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------
 Total                                                              0     0(0.00%)                                       0.00

[2019-09-26 11:12:02,440] DESKTOP-O2OE0LP/INFO/stdout: ---初始化用户---
[2019-09-26 11:12:02,440] DESKTOP-O2OE0LP/INFO/stdout:
[2019-09-26 11:12:02,940] DESKTOP-O2OE0LP/INFO/stdout: ---初始化用户---
[2019-09-26 11:12:02,940] DESKTOP-O2OE0LP/INFO/stdout:
[2019-09-26 11:12:03,439] DESKTOP-O2OE0LP/INFO/stdout: ---初始化用户---
[2019-09-26 11:12:03,439] DESKTOP-O2OE0LP/INFO/stdout:
[2019-09-26 11:12:03,941] DESKTOP-O2OE0LP/INFO/stdout: ---初始化用户---
[2019-09-26 11:12:03,941] DESKTOP-O2OE0LP/INFO/stdout:
[2019-09-26 11:12:04,442] DESKTOP-O2OE0LP/INFO/stdout: ---初始化用户---
[2019-09-26 11:12:04,442] DESKTOP-O2OE0LP/INFO/stdout:
[2019-09-26 11:12:04,943] DESKTOP-O2OE0LP/INFO/locust.runners: All locusts hatched: WebsiteUser: 5
 Name                                                          # reqs      # fails     Avg     Min     Max  |  Median   req/s
--------------------------------------------------------------------------------------------------------------------------------------------
 POST /api/chat?code=982ea76e92a211e787e1000c2913faa4              18     0(0.00%)     141      17     547  |      26    2.00
--------------------------------------------------------------------------------------------------------------------------------------------
 Total                                                             18     0(0.00%)                                       2.00
[2019-09-26 11:13:02,438] DESKTOP-O2OE0LP/INFO/locust.main: Time limit reached. Stopping Locust.
[2019-09-26 11:13:02,438] DESKTOP-O2OE0LP/INFO/locust.main: Shutting down (exit code 0), bye.
[2019-09-26 11:13:02,439] DESKTOP-O2OE0LP/INFO/locust.main: Cleaning up runner...
[2019-09-26 11:13:02,447] DESKTOP-O2OE0LP/INFO/locust.main: Running teardowns...
 Name                                                          # reqs      # fails     Avg     Min     Max  |  Median   req/s
--------------------------------------------------------------------------------------------------------------------------------------------
 POST /api/chat?code=982ea76e92a211e787e1000c2913faa4             375     0(0.00%)      34      17     547  |      25    6.20
--------------------------------------------------------------------------------------------------------------------------------------------
 Total                                                            375     0(0.00%)                                       6.20

Percentage of the requests completed within given times
 Name                                                           # reqs    50%    66%    75%    80%    90%    95%    98%    99%   100%
--------------------------------------------------------------------------------------------------------------------------------------------
 POST /api/chat?code=982ea76e92a211e787e1000c2913faa4              375     25     28     30     31     38     61    120    390    550
--------------------------------------------------------------------------------------------------------------------------------------------
 Total                                                             375     25     28     30     31     38     61    120    390    550

启动参数:

–no-web 表示不使用Web界面运行测试

-c 设置虚拟用户数。

-r 设置每秒启动虚拟用户数。

-t 设置设置运行时间。也可以使用--run-time

 

打开命令提示符,输入 locust --help

可以看到 no-web 模式相关参数:

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

 

posted @ 2019-09-26 11:36  bug灬  阅读(98)  评论(0)    收藏  举报