I need help Multiple sessions getting created for one scenario

Hi ,
I am new to Gatling. I am not understanding why new session is getting created for each request. they all belong to one scenario. Can you please help me. Below is the code what i am using. For the below higlighted requests i am expecting to have one session,. But they all have different sessions. Can you please help me

val httpProtocol = http
.baseURL(“http://d070277:7002”)
.inferHtmlResources()
.acceptHeader("/")
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.connection(“keep-alive”)
.contentTypeHeader(“text/plain;charset=UTF-8”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0”)

val headers_0 = Map(
“Accept” → “text/plain, /; q=0.01”,
“X-Requested-With” → “XMLHttpRequest”)

val headers_3 = Map(“Accept” → “text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”)

val headers_4 = Map(“Accept” → “text/css,/;q=0.1”)

val headers_28 = Map(“Accept” → “image/png,image/;q=0.8,/*;q=0.5”)

val headers_37 = Map(“X-Requested-With” → “XMLHttpRequest”)

val uri1 = “http://d070277:7002/NBSUI-web

val scn = scenario(“RecordedSimulation”)
.feed(cia_numbers)
.exec(http(“request_0”)
.get("/NBSUI-web/resources/i18n/messages.properties?_=1424104909979")
.headers(headers_0)
.resources(
http(“Basic customer profile”)
.get(uri1 + “/initialPage?phone=${phoneNumber}&languageCode=EN&num=2”)
.headers(headers_3),

http(“full CMPS”)
.get(uri1 + “/nextBestSave/getCustomerValue?subscriptionId=${subscriptionId}&phone=${phoneNumber}&languageCode=EN&=1424104945682")
.headers(headers_37),
http(“USG SUM”)
.get(uri1 + "/nextBestSave/getHistoryUsage?subscriptionId=${subscriptionId}&phone=${phoneNumber}&languageCode=EN&
=1424104945683”)
.headers(headers_37),
http(“USG MGMT”)
.get(uri1 + “/nextBestSave/getCurrentUsage?subscriptionId=${subscriptionId}&phone=${phoneNumber}&languageCode=EN&=1424104945684")
.headers(headers_37),
http(“RTAA request”)
.get(uri1 + "/nextBestSave/getOffers?subscriptionId=${subscriptionId}&phone=${phoneNumber}&languageCode=EN&
=1424104945685”)
.headers(headers_37)

))

setUp(scn.inject(rampUsers(5) over (5 seconds) )).protocols(httpProtocol)

Thanks
Tarini

Hi,

What's you problem exactly?

If you're using resources instead of regular sequential requests, those are
performed in parallel.
As such, there's no way to guarantee in which order responses will be
received, so they have different states that get reconciliated once all of
them are done.

Yes i want them to execute in parallel. i am printing the session Id in logs for each request. they are all different. Any idea why they are different sessions for each request.

What do you mean by Session id?
hashcode? yes, they would be different as they are different instances
userId? no, they would be the same

those all requests are for one user… and all those run in parllel. so ideally each user will have his own session.so those all requests for one user should print one session id. but in logs i see that they have different sessions

Once again, there’s no such “Session id”.
There’s a Session.userId that is the same all along the flow for a given virtual user.

As you configure 5 virtual users, you’d end up seeing 5 different userIds.