0

How do I use locust to perform assembly point operations similar to loadrunner I want to execute a like loadrunner set a rendezvous on a request in a locust's task , As an example i want all the virtual users to execute a request at the same time

李雪源
  • 1
  • 1

1 Answers1

0

Not sure what an assembly point or rendezvous is, as that is loadrunner specific terminology, but here's a way to make all Users sleep until they are all waiting:

class WebUser(HttpUser):
    WebUser.clients_waiting = 0
...
    @task
    def mytask(self):
        WebUser.clients_waiting = WebUser.clients_waiting + 1
        while WebUser.clients_waiting < self.environment.runner.target_user_count:
            time.sleep(1)

(note that this is per-runner, so it may not work perfectly with a distributed run)

Cyberwiz
  • 11,027
  • 3
  • 20
  • 40
  • Can you upload your complete file somewhere? – Cyberwiz Jul 01 '20 at 07:17
  • I didn't know how to upload a file, so I uploaded a picture – 李雪源 Jul 02 '20 at 01:54
  • I tried to run it but it didn't get to the point where all virtual users were doing something at the same time – 李雪源 Jul 02 '20 at 01:56
  • I want all users to do the same thing at the same time,But I don't know how to do that and I looked at the official documents and there's no explanation for that, So what do i do – 李雪源 Jul 02 '20 at 02:02
  • When you say ”it did not get to the point where all users were doing something at the same time”, what do you mean exactly? Note that the suggested implementation will only work once. You’ll need to modify it if you want to do it multiple times. – Cyberwiz Jul 02 '20 at 07:31