Requests inside foreach loop not having the same number of executions

I have this script:

.foreach("${list}", "item") {
  exec(http("Req 1")
    .post("/path/to/service/one")
    .formParam("param1", "${item}")
    .formParam("param2", "somestring")
    .formParam("param3", "${param3}")
    .check(xpath("/xmlroot/id").saveAs("id"))
    .check(xpath("/xmlroot/version").saveAs("version")))
  .exec(http("Req 2")
    .post("/path/to/service/two")
    .formParam("param1", "${param1}")
    .formParam("param2", "${param2}")
    .formParam("version", "${version}")
    .formParam("id", "${id}")
    .check(status.is(200)))
  .exec(http("Req 3")
    .post("/path/to/service/three")
    .formParam("id", "${id}")
    .formParam("param1", "somestring")
    .formParam("param2", "${item}")
    .check(xpath("/xmlroot/@id").exists))
}

It executes successfully, but it reports that there are only 2 Req 2 requests executed while there are 8 of Req 1 and Req 3. I expect there to be an equal number of requests.

It seems to be completing different number of requests each run, where it only tries to run as many Req 2 requests as it can fit in the amount of time Req 1 and Req 3 runs. Are they fired simultaneously? I assumed these are fired one after the other.

https://i.stack.imgur.com/307R3.png

Here is a screenshot of one of the reports generated. It shows that Req 2 executed 75% less times, and that the requests are also around 3 times slower than Req 1 and Req 3.

I’ve also posted this question on https://stackoverflow.com/questions/46563847/gatling-requests-inside-foreach-loop-not-having-the-same-number-of-executions.

Caching

Would you mind elaborating and/or providing a solution? Thanks.

If it is caching you can try disabling it.

https://gatling.io/docs/current/http/http_protocol/