Parallel scenarios or I am missing something?

Hi guys,

I am new to gatling and we just started using it in our company. So far so good, it is amazing , however, now I would like to make more complex scenario where I do certain action (in this case request) to endpoint for multiple users in parallel (our users not gatling users/workers).
So can anyone tell me how can I achieve such behavior? I was thinking of that I need to run the same scenario with different parameters in parallel, but then I saw https://gatling.io/docs/current/http/http_protocol/#http-client-sharing and now I am confused will that work?

`

package sandbox

import tokens.Tokens

import scala.io.Source
import scala.concurrent.duration._

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._

class CalculateBetslip extends Simulation {

val users = new Tokens
val maxUsers = Integer.getInteger(“users”, 1)

val placeBets = http
.baseURL(“host here”)
.inferHtmlResources()
.headers(
Map(
“Accept” → “/”,
“Authorization” → users.tokens(0), // ← I want this to be dynamic for each GATLING user/worker
“ContentType” → “application/json”
)
)

val headers_0 = Map(
“accept-encoding” → “gzip, deflate”,
“cache-control” → “no-cache”,
“content-length” → “291”)

val placeBetsScenario = scenario(“placeBets”)
.exec(http(“request_0”)
.post("/betting/placeBets")

setUp(placeBetsScenario.inject(atOnceUsers(1)).protocols(placeBets)) // Our api holds state, which means that here , when I supply (lets say atOnceUsers(100)) I want to use 100 different tokens but I don’t know how
}

`

Hi

I don’t know if i get your question or not, but what i understand that you want to run the same scenario with different parameters in parallel.

First of all, you can use “setUp(placeBetsScenario.inject(rampUsers(10) over (20 second) ))” to run multi users(10 in the ex) in parallel.

Then, for different parameter it’s depend on how you want to send. It can be by generating random number(Random.nextInt(MaxValue)) or by using csv feeder where u can read from it randomly or sequentially

Please let me know if that clarification helped you

Hi, no I meant real users (our customers) not virtual users of gatling, but I read about feeders and I think I solved this, but do you know by any chance if we are able to configure json feeder to start from some index?