0

I have a task which requires me to send 1 request per minute for 1000 services. I would like to control this behavior using hatch rate and clients where I will spawn 1 new client every minute and this will go on for 1000 clients. Currently, if my understanding is correct, locust is implemented in such a way that 1 client is spawned every sec. and locust is terminated after run-time is expired.

I would like to understand how can I achieve this.

Additional info :

  1. We are using distributed execution (-no-web) due to which i don't have access to UI
  2. Currently, there is no possibility to terminate the client after its execution ends nor i am aware of an approach which can help me pause the client. Currently, even after client has completed set number of iterations it keeps on pumping more requests till expiry of run time.
  3. I cannot use sleep time during execution as our end-to-end request comprises of post + get where get can take anywhere from 10 sec to 1 minute and in some cases more than 1 minute to achieve expected results

please advise.

Avataar17
  • 627
  • 1
  • 6
  • 14

1 Answers1

1

If you set hatch rate (-r) to 0.016666 (1/60) it should give you one new client per minute.

Also, you can use stop timeout (-s) to allow the last requests to finish. Set it to something you know is much longer than the longest expected response times.

There's still a chance you'll get something like 995-1005 requests but if that is acceptable then it should be ok. If not, go leave a comment at https://github.com/locustio/locust/issues/1085

Cyberwiz
  • 11,027
  • 3
  • 20
  • 40
  • HeyCyberwiz, I attempted what you suggested and to be honest, it doesn't work as we expect. Guess, we will have to identify another way to do it. this are the param values I am executing : pipenv run locust -f testsuite/host/Locust_multiclient_flow.py --master --no-web --clients 2 --hatch-rate 0.01666 --run-time 5m --host https://10.247.124.143 --only-summary what do you suggest now ? – Avataar17 May 12 '20 at 09:54
  • I thought you wanted 1000 clients, but in that command you set it to 2? Please update your question with the output from your run and what you would expect it to be. – Cyberwiz May 12 '20 at 10:17
  • Also, one thing to note is that running distributed does not prevent you from having a gui (your 1. seems to indicate you might not know that) – Cyberwiz May 12 '20 at 10:19
  • 1
    No no .. as an initial sanity i kept it as 2 .. and i believed it didn't work because in slave log, I didn't see the entry, All Locust hatched. after re-run I was able to confirm that it actually works. Thanks for the great help. – Avataar17 May 12 '20 at 12:01