Sharing data between scenarios

Hi all,

I’m setting up a simulation which basically is a set of users talking to each other over a web socket service (WebRTC).
One set of users are the callers, and the other set are the callees. An analogy would be a group of SIP users setting
up connections between themselves.

My idea here is to start one scenarion where the callees are connecting and then waiting for invites from the callers as
incoming json request on the web socket. The callers will connect and send the json request to the ws service, which
in turn will relay these to the callees web sockets.

In order for the callers to send the json request I need to extract data from the callees connect response message from

the web socket service and save this into some data structure (e.g a fifo list/stack) which the callers can access and retrieve data
from. It is basically the “phone number” the callees are assigned at connect that the callers will use in their scenario.

My first question here is whether this general plan sounds ok ? :slight_smile:

Secondly how would I go about to go from .saveAs on the web socket response to storing this in something that the other
scenario can reach rather than just storing it in the User session ? Ideally the caller user scenario would wait/pause until there
is an entry in this data structure before popping the fifo-list and proceed with the call setup.

Are there any examples out there where 2 scenarios share data ?

If this isn’t feasible my second idea was to have a feeder containing all callee “phone numbers”, however this could be
a very large set (e.g 500K) of users and from what I’ve understood this would eat a lot of heap.

Let me know if you want more info and/or snippets etc.

Cheers,
Niklas

You have to store the shared data into some thread-safe structure, such as a ConcurrentHashMap.

Hi,

Yep, I fixed it with a Queue. :slight_smile:

Maybe some defined way of sharing state between scenarios could be a (low priority) feature in the future ? Or just an example solution to the docs where multiple scenarios are discussed.

Niklas

Hi Niklas/ Stéphane,

Could you please share the example where you are sharing data between two Gatling scenarios. I am having a similar situation where I need to pass a map and two strings to other scenario. But I am not able to come up with a solution. Any help, would be highly appreciated