Is it possible to send exactly n requests from a feeder containing n records, with multiple users

Hi,

I have a csv file with 32563 lines, and I’d like to send exactly 1 request by line, with several users (just for parallelism and load).

With 1 user, it’s easy :

`
val feeder = csv(“data.csv”).queue

val scn = scenario(“dataInjector”)
.feed(feeder.queue).repeat(feeder.records.size) {
exec(http(“post_data”)
.post("/send")
.body(StringBody(???))
}

setUp (
scn.inject (atOnceUsers (1) )
).protocols (httpConf)
}

`

With 5 users, I have a little issue, I’m missing some entries if I do this, because 32563 / 5 will be rounded, and then (32563 / 5) *5 is smaller than 32563.

`

`

val nbUsers = 5


val scn = scenario("dataInjector")
.feed(feeder.queue).repeat(feeder.records.size / ````nbUsers ````) {
exec(http("post_data")
.post("/send")
.body(StringBody(???))
}

setUp (
scn.inject (atOnceUsers (nbUsers) )
).protocols (httpConf)
}

`

`

So is there a way to send exactly n requests from a feeder containing n records, with multiple users ?

Thanks,
Loïc

Use an asLongAs loop and keep track of consumed records with an AtomicInteger.

Thanks!

Loïc