Setting a session value statically is shared among user sessions


So im setting this random email generator to set a session value, works good but is an object, so I assume once I create thousands of users who call this endpoint this will have a cost. This value is passed to that json as ELexpression “email”: “${email}”.

val register: ChainBuilder = exec(options(REGISTER))
  .exec(_.set("email", new EmailGen().getTestEmail))

Basically when I do the following, (same method, just changed the EmailGen from Class to Object) all users share the same session email variable generated the first time, for some reason i do not yet understand:

val register: ChainBuilder = exec(options(REGISTER))
  .exec(_.set("email", EmailGen.getTestEmail))

This is gatling 3.0.0. Not using a feeder since all users get the other test data dynamically from previous responses.

So some related threads from years ago but dont seem to get it to work using those methods.

Any advice or a way to implement this better or etc would be really helpful.