2
votes

I have a gatling scenario where I retrieve 1000 documents from a database via a RESTful API.

I then modify the documents and send update requests for each.

This is how I'm currently doing it:

...
val scrollQueries = scenario("Enrichment Topologies").exec(ScrollQueryInitiator.query, repeat(numberOfPagesToScrollThrough, "scrollQueryCounter"){
    exec(ScrollQuery.query, pause(10 seconds).foreach("${hitsJson}", "hit"){ exec(HitProcessor.query) })
})
...

Here are the main features of interest:

  1. ScrollQuery.query fetches the 1000 results and saves them into hitsJson in the session.
  2. It then pauses for 10 seconds to simulate longer-term processing.
  3. The 1000 results are iterated over and for each item a HitProcessor is run which sends the update request

In reality, the foreach loop ensures that each request is sent one after the other.

Question

What I really want is to work through the 1000 results in groups of 10, sending update requests in parallel 10 at a time.

How can I achieve this?

1

1 Answers

0
votes

Try moving the fetch part to before hook.

Now that you have the data you can start 10 threads

setUp(  scn.inject(atOnceUsers(10)))