Locust errors
Introduction
In this article you will learn about popular Locust problems and their solutions
It is assumed that you work
in
Ubuntu Linux
I have aliases python - python3 and pip - pip3 set up, so I do not write the trailing 3.
The article about it is called
«Bash Python alias»
System open file limit '1024' is below minimum setting
You run the command
locust
And get the following warning
[2020-10-27 10:36:12,176] andrei-ubuntu/WARNING/locust.main: System open file limit '1024' is below minimum setting '10000'. It's not high enough for load testing, and the OS didn't allow locust to increase it by itself. See https://github.com/locustio/locust/wiki/Installation#increasing-maximum-number-of-open-files-limit for more info.
[2020-10-27 10:36:12,177] andrei-ubuntu/INFO/locust.main: Starting web interface at http://0.0.0.0:8089 (accepting connections from all network interfaces) [2020-10-27 11:33:44,133] andrei-ubuntu/INFO/locust.main: Starting Locust 1.3.1
The minimum number of simultaneously open files must be 10 000 or more. Otherwise locust cannot work properly
To check the limit for your
Linux
use the command
cat /proc/sys/fs/file-max
9223372036854775807
9223372036854775807 is my absolute ceiling. But we care about limits for third-party programs
Study the limits with ulimit: -Hn for the hard limit and -Sn for the soft one setrlimit
ulimit -Sn
1024
1024 is exactly the value locust complained about
Raise the limit
ulimit -Sn 10001
ulimit -Sn
10001
locust
[2020-10-27 11:33:44,124] andrei-ubuntu/INFO/locust.main: Starting web interface at http://0.0.0.0:8089 (accepting connections from all network interfaces) [2020-10-27 11:33:44,133] andrei-ubuntu/INFO/locust.main: Starting Locust 1.3.1
locust: error: unrecognized arguments: --no-web
You try to run the test without a UI and execute the command
locust -f locustfile.py --host=https://my-site.com --no-web -u 100 -r 10
And get the following warning
locust: error: unrecognized arguments: --no-web
Replace --no-web with --headless because that is what the Locust developers decided
NameError: name 'between' is not defined
You try to set wait_time
NameError: name 'between' is not defined
Most likely you simply forgot to plug in between
Add
from locust import between
libuv only supports millisecond timer resolution
You try to run the test with between and get
c:\users\andrei\pycharmprojects\locust_demo\lib\site-packages\gevent\hub.py:158: UserWarning: libuv only supports millisecond timer resolution; all times less will be set to 1 ms with loop.timer(seconds, ref=ref) as t:
Most likely you set the minimum value to 0, e.g. wait_time = between(0, 0.4)
Set a non-zero value, e.g. 0.01