# \[2.0.0-M3a\] Strange behaviour with sending 2 requests instead of one

**URL:** <https://community.gatling.io/t/2-0-0-m3a-strange-behaviour-with-sending-2-requests-instead-of-one/731>\
**Category:** Gatling (Open-Source)\
**Created:** [December 17, 2013, 10:28am UTC](https://community.gatling.io/t/2-0-0-m3a-strange-behaviour-with-sending-2-requests-instead-of-one/731 "2013-12-17T10:28:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Artem\_Nikitin](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Artem\_Nikitin](https://community.gatling.io/u/Artem_Nikitin)\
**Post date:** [December 17, 2013, 10:28am UTC](https://community.gatling.io/t/2-0-0-m3a-strange-behaviour-with-sending-2-requests-instead-of-one/731/1 "2013-12-17T10:28:03Z")

</div>

Hi. I’m use gatling 2.0.0-M3a.

My scenario look like this:

val scn = scenario(“load-test”)  
.exec(  
http(“create”)  
.put(\_ =\> getURL)  
.body(StringBody(\_ =\> getBody))  
.header(“Accept”, “text/json”)  
.check(status.is(200))  
)  
.pause(2000 milliseconds)  
.exec(  
http(“pay”)  
.post(xml\_url)  
.body(StringBody(\_ =\> getXML))  
.check(status.is(200))  
.check(xpath("//result-code").is(“0”))  
)

It works that:

1. create bill
2. wait a little bit
3. pay bill

I have a situation when second request sends 2 times instead of one. It clearly looks from server log. Gatling sends first requests and get response with result\_code = 0 on that. It means all fine. Then after some ms gatling sends another exact same request and get response with result\_code = 1419 that means that bill already paid. I suppose in report gatling saves result of second requests only and ignore first positive result.

You can see attached log for details. I delete some sensitive info from log, but keep id.  
[https://s3-us-west-2.amazonaws.com/artemnikitin-test/double\_request\_log.txt](https://s3-us-west-2.amazonaws.com/artemnikitin-test/double_request_log.txt)

This is normal behaviour ?

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [December 17, 2013, 10:41am UTC](https://community.gatling.io/t/2-0-0-m3a-strange-behaviour-with-sending-2-requests-instead-of-one/731/2 "2013-12-17T10:41:07Z")

</div>

For what I see, the problem is on your side, either in the getXML that generates duplicates, or in your system under stress.

First request is sent by user n°4423 while the second one is sent by user n°4425:

Session(load-test, **4423** ,Map(),1387273991914,33,List(),List(OK),List(),List()) **HSsZSWd9zj**  **0** Session(load-test, **4425** ,Map(),1387273991964,13,List(),List(KO),List(),List()) **HSsZSWd9zj**  **1419**

---

<div class="post-metadata">

**Author:** ![Artem\_Nikitin](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Artem\_Nikitin](https://community.gatling.io/u/Artem_Nikitin)\
**Post date:** [December 17, 2013, 11:54am UTC](https://community.gatling.io/t/2-0-0-m3a-strange-behaviour-with-sending-2-requests-instead-of-one/731/3 "2013-12-17T11:54:01Z")

</div>

What number of requests can handle Core i5 with 8GB RAM ?  
If I need a small load but for long time for example I want 50 rps but for 8 hours. It’s like 1.5 million requests total. How Gatling will behave ? He will use only 50 threads and “reload” it when request finished or not ?

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [December 17, 2013, 12:04pm UTC](https://community.gatling.io/t/2-0-0-m3a-strange-behaviour-with-sending-2-requests-instead-of-one/731/4 "2013-12-17T12:04:45Z")

</div>

No no no no no, you don’t get it!  
Gatling’s virtual users are not threads, but asynchronous messages.

Gatling uses about:

- 1 main thread
- 1 timer thread
- 1\*nb cores for AsyncHttpClient
- 2\*nb cores for Netty
- 3\*nb cores for Akka  
That’s roughly 50 threads on an 8 core machine.

Number of concurrent users/messages processed have nothing to do with this.

---

<div class="post-metadata">

**Author:** ![Artem\_Nikitin](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Artem\_Nikitin](https://community.gatling.io/u/Artem_Nikitin)\
**Post date:** [December 17, 2013, 1:23pm UTC](https://community.gatling.io/t/2-0-0-m3a-strange-behaviour-with-sending-2-requests-instead-of-one/731/5 "2013-12-17T13:23:56Z")

</div>

Ok, I get it ) Thanks

---

<div class="post-metadata">

**Author:** ![Floris\_Kraak](https://avatars.discourse-cdn.com/v4/letter/f/848f3c/32.png) [@Floris\_Kraak](https://community.gatling.io/u/Floris_Kraak)\
**Post date:** [December 17, 2013, 1:57pm UTC](https://community.gatling.io/t/2-0-0-m3a-strange-behaviour-with-sending-2-requests-instead-of-one/731/6 "2013-12-17T13:57:22Z")

</div>

Fun. A classic concurrency issue.  
Looks like server side threads are polluting each others data.  
Your developers will probably say this can’t happen. Normal functional tests won’t show it.  
Best thing to do is to document this carefully so that the proof is unassailable. Then refine your test cases to check for other symptoms: if this happens, it’s likely that this causes other subtle issues as well.
