Skip to content

Commit

Permalink
Change recommended to minimum
Browse files Browse the repository at this point in the history
  • Loading branch information
parberge committed Sep 18, 2020
1 parent f4b742a commit 1369b20
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,17 @@ def main():
try:
import resource

recommended_open_file_limit = 10000
minimum_open_file_limit = 10000
current_open_file_limit = resource.getrlimit(resource.RLIMIT_NOFILE)[0]

if current_open_file_limit < recommended_open_file_limit:
if current_open_file_limit < minimum_open_file_limit:
# Increasing the limit to 10000 within a running process should work on at least MacOS.
# It does not work on all OS:es, but we should be no worse off for trying.
resource.setrlimit(resource.RLIMIT_NOFILE, [recommended_open_file_limit, resource.RLIM_INFINITY])
resource.setrlimit(resource.RLIMIT_NOFILE, [minimum_open_file_limit, resource.RLIM_INFINITY])
except BaseException:
logger.warning(
(
f"System open file limit '{current_open_file_limit}' is below recommended setting '{recommended_open_file_limit}'. "
f"System open file limit '{current_open_file_limit}' is below minimum setting '{minimum_open_file_limit}'. "
"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."
)
Expand Down Expand Up @@ -230,8 +230,7 @@ def main():

if options.master:
runner = environment.create_master_runner(
master_bind_host=options.master_bind_host,
master_bind_port=options.master_bind_port,
master_bind_host=options.master_bind_host, master_bind_port=options.master_bind_port,
)
elif options.worker:
try:
Expand Down

0 comments on commit 1369b20

Please sign in to comment.