locust icon indicating copy to clipboard operation
locust copied to clipboard

I am using the custom client for my project. I want to load test with distribution of workers. But to start 10 workers, I need to start typing command "locust -f main.py --worker" for ten times. why do not locust have a new feature to run it in the single command like "locust -f ... --workers 10"?

Open leela2299 opened this issue 2 years ago • 6 comments

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

leela2299 avatar Jun 18 '22 18:06 leela2299

in order to have multiple workers you should run workes in separate processes (in order to properly utilize cpu power).

simple bash script will be handy:

export LOCUST_HOST="https://example.com"

for i in {1..$1}; do
    ( locust  --worker & )
done

locust --master --expect-workers=$1

Sawiq avatar Jun 27 '22 13:06 Sawiq

This can already be done with docker compose. There’s an example compose file you can find here https://github.com/locustio/locust/blob/master/examples/docker-compose/docker-compose.yml. There are lots of resources elsewhere about how docker compose works and how to use it. Here’s one example:

https://docs.docker.com/compose/gettingstarted/

When using docker compose you can use --scale worker=10 and it will automatically start 10 different workers for you.

solowalker27 avatar Jul 21 '22 15:07 solowalker27

I’d love for this to be a feature. Should be pretty easy to do using Pythons multiprocessing, but I have no experience with it. Anybody wanna have a go at it?

cyberw avatar Jul 21 '22 16:07 cyberw

@cyberw I think you can relatively easy achieve that starting from Using locust as a library

Sawiq avatar Jul 21 '22 17:07 Sawiq

Sure, but I’m talking about building it as a standard feature (using command line arguments/main.py). I’m just trying to get someone else to do it for me, instead of doing everything myself :)

cyberw avatar Jul 21 '22 19:07 cyberw

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Sep 20 '22 02:09 github-actions[bot]

@Sawiq Can you post sample code to configure master and slave when running locust as library and want to generate test in distributed mode.

rkhemka24 avatar Sep 29 '22 12:09 rkhemka24

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Nov 30 '22 02:11 github-actions[bot]

This issue was closed because it has been stalled for 10 days with no activity. This does not necessarily mean that the issue is bad, but it most likely means that nobody is willing to take the time to fix it. If you have found Locust useful, then consider contributing a fix yourself!

github-actions[bot] avatar Dec 11 '22 02:12 github-actions[bot]