One user creates room, another joins

Not sure how to go about this one. How do I do a load test for:

  1. A creates lobby
  2. B joins

From what I understand so far, all tests are independent of each other. How do I wait for a VU to finish doing “A creates lobby” before another VU does “B joining A’s lobby”?

Create the lobby in test init and then join it?

Create the lobby with one VU, have other VU’s running to poll for existing lobbies, join one when a lobby is available?

In this case your best bet would either be to

  • do as @k6jonne suggested and create the room in init and then join it as part of your actual vu function.
  • as the vu will execute statements sequentially, do both operations in the same VU.

I would opt for the second approach, as tests in general benefit from staying independent.

Yes I guess in the end it depends on what kind of load test you want to perform. If you want to create a number of rooms, a number of users, and then join rooms, create rooms, delete rooms, send messages from users across rooms, etc. in parallel, it gets harder to do that sequentially and produce desired load.