How to use Gatling for bulk operations

I’ve brought this up in the past, but as sometimes happens, it has come up again…

We’d like to use Gatling as a convenient way to perform a set of operations with a degree of parallelization. In this case, we want to make sure that none of our test users are currently in a locked-out state, to ensure that when we try to authenticate with them, they will succeed.

More generally, we’d like to process every record in a feeder file, and cleanly exit when the feeder is empty. We’d like to be able to do it using multiple concurrent users in a closed model injection profile.

The trick is, we don’t want all running users to terminate as soon as the feeder is empty. We want to let running virtual users finish, and cleanly exit the simulation.

Is there a way to configure an empty feeder to terminate the injector without terminating running virtual users?

If not, what is the current best practice for this kind of thing?

Don’t use a closed workload model. Use a finite number of users and make them loop.
Compute number of users and iterations based on feeder size.

Agreed, that is probably the cleanest way. How can I get the record count? I don’t see a .length or .size method. I see readRecords, which I can iterate over to get a count, but then how do I rewind the feeder back to the beginning for use in the simulation?

readRecords returns a Seq, no need to iterate.
It returns a copy of the data, so there’s nothing to rewind.

I remember wanting to add a length method, but it never landed and I can’t remember why…

FYI, we tried setting the feeder to circular, in case the number of records in the feeder was not an even multiple of the number of concurrent users, that way we would just re-try the first few records. Naturally, readRecords does not know not to cycle back to the beginning, and it is caught in and endless loop until the JVM runs out of memory. Oops! :slight_smile: