# Incorrect req/sec getting simulated

**URL:** <https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235>\
**Category:** Gatling (Open-Source)\
**Created:** [September 2, 2016, 1:14am UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235 "2016-09-02T01:14:52Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![CyberNinja](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@CyberNinja](https://community.gatling.io/u/CyberNinja)\
**Post date:** [September 2, 2016, 1:14am UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/1 "2016-09-02T01:14:52Z")

</div>

I created a scenario to run with 50 users and pac as 10sec with the objective to achieve 10 req/sec for the block of requests (1, 2 and 3).  
But what actually happening is that, in “Global Information” section of the report I see 10 req/sec and each request (1, 2 and 3) show 3.3 req/sec each.

I was assuming that my setup should have shown “Global Information” with 30 req/sec and 10req/sec for each request type. What am I missing here?

`  
def workload (step: Int, pacing: Int, duration: Int) = scenario(s"Workload Step $step")  
.during(duration seconds){  
pace(pacing seconds)  
.exitBlockOnFail {  
feed(conversationIdFeeder)  
.feed(requestIdFeeder)  
.group(“Request1”) {exec(Request1)}  
.feed(requestIdFeeder)  
.group(“Request2”) {exec(Request2)}  
.feed(requestIdFeeder)  
.group(“Request3”){exec(Request3)}  
}  
}

setUp(  
workload(1,5,250).inject(  
nothingFor(10 seconds),  
rampUsers(50) over(50 seconds),  
nothingFor(220 seconds)  
)  
).protocols(httpProtocol)  
`

`Requests Total OK KO % KO Req/s Global Information 2464 2464 0 0% 10.855 Request1 822 822 0 0% 3.621 Request2 821 821 0 0% 3.617 Request3 820 820 0 0% 3.612`

---

<div class="post-metadata">

**Author:** ![CyberNinja](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@CyberNinja](https://community.gatling.io/u/CyberNinja)\
**Post date:** [September 5, 2016, 6:21am UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/2 "2016-09-05T06:21:19Z")

</div>

Is there any fundamental limitation in gatling which I am missing? I added more users keeping other settings same but still the load isn’t increasing.

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [September 5, 2016, 2:50pm UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/3 "2016-09-05T14:50:24Z")

</div>

my2cents: caching

---

<div class="post-metadata">

**Author:** ![CyberNinja](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@CyberNinja](https://community.gatling.io/u/CyberNinja)\
**Post date:** [September 5, 2016, 10:16pm UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/4 "2016-09-05T22:16:44Z")

</div>

Caching should improve response times which is not happening. Why would caching affect the load being injectrd? Can you please put few more cents and elaborate? Those three requests in my simulation are REST apis.

---

<div class="post-metadata">

**Author:** ![CyberNinja](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@CyberNinja](https://community.gatling.io/u/CyberNinja)\
**Post date:** [September 6, 2016, 12:22am UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/5 "2016-09-06T00:22:24Z")

</div>

I tried with disableCaching at httpProtocol level as well but no luck. Any advise would be really helpful. Thank you!

---

<div class="post-metadata">

**Author:** ![CyberNinja](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@CyberNinja](https://community.gatling.io/u/CyberNinja)\
**Post date:** [September 7, 2016, 2:29am UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/6 "2016-09-07T02:29:20Z")

</div>

I removed **during** and **pace** from the scenario and tried to load 10 users using **ConstantUsersPerSec.** This should have given me 10reqs/sec for each request type. Still the rps for each request is getting limited to **2 req/sec**!!. I understand that if the combined response time is \> 1 sec the RPS would reduce. But 90% of response times are less than 1 sec so there is no reason why it should limit the rps to 2req/sec. So frustrating. I have spent 3 days on this investigation. As I am out of options now my manager has advised me explore another tool but I really don’t want to give up ☹

**Attaching simulation.log**

`  
def workload (step: Int, pacing: Int, duration: Int) = scenario(s"Workload Step $step")  
.exitBlockOnFail {  
feed(conversationIdFeeder)  
.feed(requestIdFeeder)  
.group(“Request1”) {exec(Request1)}  
.feed(requestIdFeeder)  
.group(“Request2”) {exec(Request2)}  
.feed(requestIdFeeder)  
.group(“Request3”){exec(Request3)}  
}

setUp(  
workload.inject(  
nothingFor(10 seconds),

rampUsers(10) over(10 seconds),  
constantUsersPerSec(10) during(200 seconds),  
nothingFor(10 seconds)  
)  
).protocols(httpProtocol)

`

[simulation.log](https://community.gatling.io/uploads/short-url/CWnK0Emo8ZPBNyjb0weCvVJNK3.log) (496 KB)

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [September 7, 2016, 8:32am UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/7 "2016-09-07T08:32:27Z")

</div>

Your maths are wrong.  
You don’t have a constant number of concurrent users as you use “rampUsers”. You only get the numbers you expect during the plateau, but the global stats account for the ramp up and the ramp down.

---

<div class="post-metadata">

**Author:** ![CyberNinja](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@CyberNinja](https://community.gatling.io/u/CyberNinja)\
**Post date:** [September 7, 2016, 10:43am UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/8 "2016-09-07T10:43:11Z")

</div>

Where has it gone wrong?  
I am assuming your response was related to my first scenario (which had during and pace): i was ramping up 50 users over 50 sec and then kept them running for 250 sec with a pace of 5 sec. So 50 users with a pace of 5 sec should have given me 10 req/s for each request. I understand "global information" includes ramp up and ramp down. I sent the table only for reference. I see the same stats even for the steady state duration of 250 sec.

In second scenario which has ConstantUsersPerSec with 10 users should have fired 10 req/s for each req regardless of server response. All i see  
Is 2 req/s.

---

<div class="post-metadata">

**Author:** ![CyberNinja](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@CyberNinja](https://community.gatling.io/u/CyberNinja)\
**Post date:** [September 8, 2016, 11:38pm UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/9 "2016-09-08T23:38:33Z")

</div>

Alright, I have figured out the problem. Nothing is wrong with the scenario configurations. One of the feeders in my scenario was calling an external jar and that was taking considerable to generate value feed values.

I believe the execution time of feeders isn’t logged so it went unnoticed (please correct me if I am wrong). Now I pre-generate the required feeds and load them as csv feeder.  
Thank you for your helps.

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [September 11, 2016, 7:00pm UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/10 "2016-09-11T19:00:31Z")

</div>

Glad you found it out.  
All the built-in feeders that we provide perform data fetching and parsing on simulation start up so they can’t suffer from such flaw.  
Performance wise, doing something like tons of SQL requests would be a bad idea.

---

<div class="post-metadata">

**Author:** ![CyberNinja](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@CyberNinja](https://community.gatling.io/u/CyberNinja)\
**Post date:** [September 11, 2016, 11:43pm UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/11 "2016-09-11T23:43:45Z")

</div>

Thanks. The external jar was doing heavy encryption.

One question: In the following scenario, I was intending to inject the load in steps of 2tps (2tps-\>4tps-\>6tps and so on) but didn’t happen accurately. 4/8/12 tps got injected correctly whereas 2/6/10 tps shows hiccups. If gatling uses asynchttpclient why would this happen?

The scenario had following type of setup

`def workload (step: Int, pacing: Int, duration: Int) = scenario(s"Workload Step $step") .during(duration seconds){ pace(pacing seconds) .exitBlockOnFail {...`

[![](https://lh3.googleusercontent.com/-eqQl7cJAxtA/V9XqmbdnslI/AAAAAAAABOo/vONGoERDPhMOpUK8TxkuhlPumUxuNv4iwCLcB/s1600/RequestsPerSec.png)](https://lh3.googleusercontent.com/-eqQl7cJAxtA/V9XqmbdnslI/AAAAAAAABOo/vONGoERDPhMOpUK8TxkuhlPumUxuNv4iwCLcB/s1600/RequestsPerSec.png)

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [September 12, 2016, 11:57am UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/12 "2016-09-12T11:57:58Z")

</div>

Could you provide a full gist, please?

---

<div class="post-metadata">

**Author:** ![CyberNinja](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@CyberNinja](https://community.gatling.io/u/CyberNinja)\
**Post date:** [September 12, 2016, 11:14pm UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/13 "2016-09-12T23:14:05Z")

</div>

Simulation log for the test attached. Scenario definition and setup definition below.

`

def pVusers: Int = Integer.getInteger(“vusers”, 20)  
def pPacing: Int = Integer.getInteger(“pacing”, 10) // in seconds  
def pTps: Int = Integer.getInteger(“tps”, 2) // pVusers/pPacing``

def pRampTime: Int = Integer.getInteger(“rampUpTime”, 5) // in seconds  
def pStepTime: Int = Integer.getInteger(“stepTime”, 60) //in seconds 1200  
def pNumSteps: Int = Integer.getInteger(“numSteps”, 20) //number of steps of incremental load

//scenario  
def workload (step: Int, pacing: Int, duration: Int) = scenario(s"STEP NO $step").during(duration seconds){  
pace(pacing seconds)  
.exec(  
exitBlockOnFail {  
feed(requestIdFeeder)  
//.group(“ION PRVS GF”) {  
.exec(session =\> {  
session.set(“url”, spBrokerURL)  
})  
.group(“RequestGroup1”){exec(request1)}  
.feed(requestIdFeeder)  
.group(“RequestGroup2”){exec(request2)}  
.feed(requestIdFeeder)  
.group(“RequestGroup3”){exec(request3)}  
})}

val stepsParams = 1 to pNumSteps map { i =\> {  
workload(i, pPacing, ((pNumSteps - i + 3) \* (pRampTime+pStepTime)))  
.inject(  
nothingFor((i-1) \* (pRampTime+pStepTime) seconds),  
rampUsers(pVusers) over (pRampTime seconds),  
nothingFor(pStepTime seconds))

}  
}

println(“Load Pattern:” + stepsParams + “\n”)

setUp(stepsParams:\_\*)  
.protocols(httpProtocol)  
.assertions(  
global.responseTime.max.lessThan(10000)  
)

`

---

<div class="post-metadata">

**Author:** ![CyberNinja](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@CyberNinja](https://community.gatling.io/u/CyberNinja)\
**Post date:** [September 12, 2016, 11:15pm UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/14 "2016-09-12T23:15:20Z")

</div>

Sorry, simulation log attached now.

[simulation.log](https://community.gatling.io/uploads/short-url/lzO1ax8bj1ZZcNJL1SdDIlCmni4.log) (2.34 MB)

---

<div class="post-metadata">

**Author:** ![CyberNinja](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@CyberNinja](https://community.gatling.io/u/CyberNinja)\
**Post date:** [September 20, 2016, 11:54pm UTC](https://community.gatling.io/t/incorrect-req-sec-getting-simulated/3235/15 "2016-09-20T23:54:08Z")

</div>

Did anyone have a chance to look into this? I am facing this issue quite frequently.  
Issue is: I was intending to inject the load in steps of 2tps (2tps-\>4tps-\>6tps and so on) but didn’t happen accurately. 4/8/12 tps got injected correctly whereas 2/6/10 tps shows hiccups. If gatling uses asynchttpclient why would this happen?

Here is graph from another test.

[![](https://lh3.googleusercontent.com/-O9TuPWO_tG4/V-HMC15wyZI/AAAAAAAABPg/vELSj2qxsz0NHL2vYGgODilVPJLjv5QrACLcB/s320/incosistent%2BLoad%2BSimulation.png)](https://lh3.googleusercontent.com/-O9TuPWO_tG4/V-HMC15wyZI/AAAAAAAABPg/vELSj2qxsz0NHL2vYGgODilVPJLjv5QrACLcB/s1600/incosistent%2BLoad%2BSimulation.png)
