Unique test data per VU without reserving data upfront

@niklasbae, can you please confirm something, just to make sure I understand you correctly? If the number of top-level users you have in your JSON is X, you want Y number of VUs to go through them, where X > Y? And every VU sequentially goes through all of the subusers of its current user and when it is done, it goes to work on the next top-level user that is not yet claimed by another VU?

And in your case, you’re making do with {executor: "per-vu-iterations", vus: X, iterations: 1} scenario, which makes X == Y, but this is not optimal since some VUs finish much earlier than others?

If so, then as @mstoykov mentioned, there isn’t currently a good way to handle the X < Y case in k6, right now. You need a something like a global iterator, and his xk6 extension can work if you only execute the script locally.

In the future, we might support something similar natively in k6. Please follow Data segmentation API framework · Issue #1539 · grafana/k6 · GitHub (and maybe Improve execution information in scripts · Issue #1320 · grafana/k6 · GitHub) for more updates. With the execution segments we have since k6 v0.27.0, we should be able to make a bounded iterator that would work both in a single-instance as well as a distributed k6 test run, with some restrictions that wouldn’t be an issue for your use case. I can’t give any estimates yet, the current v0.31.0 milestone of the first issue is mostly wishful thinking, but hopefully we’ll make something like it soon. Even an MVP version will likely cover your use case…

2 Likes