Ramping VUs with exactly one iteration per VU

Hi,

Is it possible to set up k6 to run ramping VUs but with each VU running exactly one iteration? Basically, I’d like to make sure that if an error occurs, the VU is not re-run. I tried using the thresholds, but they seem to apply to the whole test, so a single error makes the entire test fail.

Hi @vlad_stryapko,

Can you explain what you are trying to simulate that this is a requirement?

Also, do you want to always do 1 iteration regardless of whether it will error out at some point or not?

As a quick workaround (that will break iteration_duration and interrupted iterations) I would propose just adding a “big” sleep whenever you don’t want to make any more iterations with a given VU. This also will mean that your script will run for as long as it’s your maxDuration(10m by default) + gracefulstop ( 30s by default)

Yeah, sure.

I’m working with web sockets, my flow is establishing a connection, which is a pretty costly operation, and then sending thousands and thousands of messages, measuring how much time passes between the message and the response to it. As far as I know, there is no way to re-use state between function runs, so 1 iteration of my function is actually thousands of iterations of the “test”.

Also, do you want to always do 1 iteration regardless of whether it will error out at some point or not?

Yes, but I’d still like to use Ramping VUs, so fixed iterations with fixed VUs won’t work. For instance, I’d like to start with ~100 users generating messages and go up to 10k.

As a quick workaround (that will break iteration_duration and interrupted iterations) I would propose just adding a “big” sleep whenever you don’t want to make any more iterations with a given VU.

Yeah, I thought of the workarounds and came to the same conclusion. It would mean I’ll have a couple of “dead” VUs, but I think it’s fine considering that I don’t expect the number of errors to be very high.

Yeah, I think that no current executor does this.

An alternative workaround will be to use shared-iterations and sleep at the beginning of the iteration instead. This at least will remove the interrupted iteration problem but will mean that you will need to write some formula on how long you should sleep, which you might use to gain more control :man_shrugging: .

Hope this helped you and good luck