Share session variables between sessions and run scenarios in parallel

Background / Issue Description

I have an API called xAPI that returns a value called tabId.
This tabId needs to be used as an input parameter in two other APIs: yAPI and zAPI.

Conditions:

  1. yAPI and zAPI must run in parallel.

  2. yAPI must be executed 5 times concurrently, and zAPI must be executed 10 times concurrently. ( All 15 API calls should be called concurrently)

  3. All executions of yAPI and zAPI should use the same tabId returned from xAPI.

  4. yAPI calls and zAPI calls should start concurrently.

When a scenario runs with multiple virtual users, how does Gatling handle variable sharing between those users?

Gatling version:
Gatling flavor: java
Gatling build tool: gradle

you may need this Gatling session scripting reference - Expression Language

Each virtual user will have their own session data.

So testing wise, it should be running these 2 scenario in parallel:

scn 1: xAPI -> yAPI
scn 2: xAPI -> zAPI

trigger both scenario will make them run parallel, while allows you to easily config correct number of user / requests for each API.

If you need to share data between virtual users:

  • if you run a single load generator, you need a data structure that supports concurrent updates, like a concurrent queue or a concurrent hashmap
  • if you need to distribute over multiple load generators, you’ll need a remote store like Redis