question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Performance drops when many env vars are defined

See original GitHub issue

Description of issue

Locust performance drops significantly when hundreds of environment variables are defined.

Expected behavior

Locust performance is not affected by the number of environment variables.

Actual behavior

For large number of environment variables Locust performance on Python 3 drops by:

  • ~35% on 100 vars
  • ~85% on 1000 vars

On Python 2 the drop is ~32% with 1000 vars.

Environment settings (for bug reports)

  • OS: Ubuntu 16.04.5
  • Python version: 3.5.2
  • Locust version: 0.9.0

Steps to reproduce (for bug reports)

# create docker network
docker network create example
# run nginx in a separate container
docker run -d --net example --name nginx nginx

# run ubuntu container, install locust and run the test
docker run --net example -ti ubuntu bash
# run commands below inside the ubuntu container
apt-get -q2 update;apt-get -q2 dist-upgrade;apt-get -q2 install python3-pip nginx;python3 -m pip install locustio
# create a scenario file
echo -e "from locust import HttpLocust\n\
from locust import TaskSet\n\
from locust import task\n\
\n\
class SimpleBehavior(TaskSet):\n\
    @task\n\
    def index(self):\n\
        self.client.get('/')\n\
\n\
class MyLocust(HttpLocust):\n\
    task_set = SimpleBehavior\n\
    min_wait = 0\n\
    max_wait = 0\n\
" > test.py
# count env vars
env | wc -l
# 8 vars
# run test
locust -f ./test.py --host=http://nginx.example --no-web -c 10 -r 10 -t 60 --only-summary
# showed 569.00 rps
# create 100 more env vars
for i in {1..100}; do export ENV_$i=abcde;done;env|wc -l
# outputs 108
locust -f ./test.py --host=http://nginx.example --no-web -c 10 -r 10 -t 60 --only-summary
# showed 379 rps
# create 1000 env vars
for i in {1..1000}; do export ENV_$i=abcde;done;env|wc -l
# outputs 1008
locust -f ./test.py --host=http://nginx.example --no-web -c 10 -r 10 -t 60 --only-summary
# showed 81.75 rps
# re-run with python2.7
apt-get -q2 install python-pip;python -m pip install locustio 
locust -f ./test.py --host=http://nginx.example --no-web -c 10 -r 10 -t 60 --only-summary
# showed 393

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
scherniavskycommented, Oct 31, 2019

I also can’t reproduce it anymore. The issue appeared for Locust 0.9 on Ubuntu 16.04, so maybe something got fixed between the versions.

1reaction
cgoldbergcommented, Sep 13, 2018

since you are testing against localhost, it’s not really possible to determine if this slowdown is caused by Locust or the system under test. Locust is competing with it. Your system under test should always be on a different machine so it’s not competing for resources.

Also note that Locust RPS will decrease as response time from your app increases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Very slow performance with large number of env vars ... - GitHub
When you run your app on Kubernetes there are a lot of env vars defined. At least two for each service. So in...
Read more >
Troubleshoot issues when passing environment variables to ...
I want to troubleshoot issues when passing environment variables to my Amazon Elastic Container Service (Amazon ECS) task.
Read more >
Environment Variables: What They Are and How To Use Them
Switching environments is as simple as changing the env file itself. You can store multiple files by the names .env.dev , .env.prod ,...
Read more >
Env Variables - AFLplusplus
This document discusses the environment variables used by AFL++ to expose various ... up the forkserver and causes a pretty significant performance drop....
Read more >
Data source references based on environment variables aren't ...
Describes an issue when importing a solution to a different environment, data source references based on environment variables aren't ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found