# Scenarios throughput configuration

**URL:** <https://community.gatling.io/t/scenarios-throughput-configuration/774>\
**Category:** Gatling (Open-Source)\
**Created:** [January 14, 2014, 11:20am UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774 "2014-01-14T11:20:13Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedos.serg](https://avatars.discourse-cdn.com/v4/letter/f/f1d935/32.png) [@fedos.serg](https://community.gatling.io/u/fedos.serg)\
**Post date:** [January 14, 2014, 11:20am UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/1 "2014-01-14T11:20:13Z")

</div>

Hello,  
I’m currently a jmeter user and looking forward to rewrite some tests using Gatling.  
First issue I faced is absence of scenarios throughput control (like constant throughput timer in jmeter). Manual pause doesn’t fit my requirement as I need ability to configure throughput i. e. for scalability tests and I can not just multiply or divide pause value as execution time may be non linear for different scenarios.

Didn’t find any description of this feature in docs or on the internet - is there one? If not can it be implemented in Gatling?

---

<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:** [January 14, 2014, 11:23am UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/2 "2014-01-14T11:23:52Z")

</div>

Hi,

It’s implemented in master and will be shipped in next Gatling 2 milestone.

If you want to give it a try, you can grab a snapshot here: [https://oss.sonatype.org/content/repositories/snapshots/io/gatling/highcharts/gatling-charts-highcharts/2.0.0-SNAPSHOT/](https://oss.sonatype.org/content/repositories/snapshots/io/gatling/highcharts/gatling-charts-highcharts/2.0.0-SNAPSHOT/)

It’s called throttling, and here’s what it looks like: [https://github.com/excilys/gatling/blob/master/gatling-bundle/src/test/scala/io/gatling/bundle/test/HTTPCompileTest.scala#L234](https://github.com/excilys/gatling/blob/master/gatling-bundle/src/test/scala/io/gatling/bundle/test/HTTPCompileTest.scala#L234)

---

<div class="post-metadata">

**Author:** ![fedos.serg](https://avatars.discourse-cdn.com/v4/letter/f/f1d935/32.png) [@fedos.serg](https://community.gatling.io/u/fedos.serg)\
**Post date:** [January 14, 2014, 11:26am UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/3 "2014-01-14T11:26:25Z")

</div>

Thx, will try

---

<div class="post-metadata">

**Author:** ![Kan\_Wu](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@Kan\_Wu](https://community.gatling.io/u/Kan_Wu)\
**Post date:** [January 22, 2014, 8:25pm UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/4 "2014-01-22T20:25:57Z")

</div>

i tried like this

setUp(scn.inject(rampUsers(500).over(2 minutes))  
.throttle(jumpToRps(20), reachRps(100) in (120 seconds), holdFor(1200 seconds)))  
.pauses(uniformPausesPlusOrMinusPercentage(1))  
.disablePauses  
.constantPauses  
.exponentialPauses  
.uniformPauses(1.5)  
.uniformPauses(1337 seconds)

but rps always jumped to 140 or higher very quickly. and seems like the pauses i added in groups stopped working. i guess .disablePauses made the trick.

any ideas? i made something wrong? i grabbed the latest snapshot version btw.

Thanks!

在 2014年1月14日星期二UTC-8上午3时26分25秒，fedos…@gmail.com写道：

---

<div class="post-metadata">

**Author:** ![Kan\_Wu](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@Kan\_Wu](https://community.gatling.io/u/Kan_Wu)\
**Post date:** [January 23, 2014, 1:50am UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/5 "2014-01-23T01:50:36Z")

</div>

even i removed all the pause stuff, the result is still the same. wrong way of using it?

在 2014年1月14日星期二UTC-8上午3时23分52秒，Stéphane Landelle写道：

---

<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:** [January 23, 2014, 9:09am UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/6 "2014-01-23T09:09:56Z")

</div>

Nope, probably a bug. Investigating.

---

<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:** [January 23, 2014, 10:27am UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/7 "2014-01-23T10:27:05Z")

</div>

Should be better now.

However, when I developed the thing, it made sense to me to automatically disable pauses when using throttling.

Opinion?

---

<div class="post-metadata">

**Author:** ![Kan\_Wu](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@Kan\_Wu](https://community.gatling.io/u/Kan_Wu)\
**Post date:** [January 23, 2014, 6:12pm UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/8 "2014-01-23T18:12:36Z")

</div>

i grabbed the latest snapshot version but still my throughput jumped to 200 immediately.

setUp(scn.inject(rampUsers(500).over(2 minutes))  
.throttle(jumpToRps(20), reachRps(100) in (120 seconds), holdFor(1200 seconds)))  
.protocols(httpConf)

disable all pauses in script makes sense to me since the throttle module will add pauses based on rps target. can i get a sample how you are using it? it is possible that i used it in a wrong way.

Thanks

在 2014年1月23日星期四UTC-8上午2时27分05秒，Stéphane Landelle写道：

---

<div class="post-metadata">

**Author:** ![Kan\_Wu](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@Kan\_Wu](https://community.gatling.io/u/Kan_Wu)\
**Post date:** [January 23, 2014, 7:02pm UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/9 "2014-01-23T19:02:18Z")

</div>

from what i observed, the pauses i added into the script stopped working so this is expected. but the new pauses that should be added by throttle are not working, i guess?

在 2014年1月23日星期四UTC-8上午10时12分36秒，Kan Wu写道：

---

<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:** [January 23, 2014, 11:05pm UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/10 "2014-01-23T23:05:27Z")

</div>

Here it my test: [https://gist.github.com/slandelle/8588606](https://gist.github.com/slandelle/8588606)

---

<div class="post-metadata">

**Author:** ![Kan\_Wu](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@Kan\_Wu](https://community.gatling.io/u/Kan_Wu)\
**Post date:** [January 23, 2014, 11:13pm UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/11 "2014-01-23T23:13:14Z")

</div>

i think i know why now. i used this one as the sample to write: [https://github.com/excilys/gatling/blob/master/gatling-bundle/src/test/scala/io/gatling/bundle/test/HTTPCompileTest.scala](https://github.com/excilys/gatling/blob/master/gatling-bundle/src/test/scala/io/gatling/bundle/test/HTTPCompileTest.scala).

in that code, .throttle is part of inject.

in your test, .throttle is out of setUp. now it works fine.

Thanks a lot for your help!

在 2014年1月23日星期四UTC-8下午3时05分27秒，Stéphane Landelle写道：

---

<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:** [January 23, 2014, 11:17pm UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/12 "2014-01-23T23:17:03Z")

</div>

Do you have several populations in your simulation?  
If you define throttle on a population, you only throttle it and don’t affect the other ones.

---

<div class="post-metadata">

**Author:** ![Kan\_Wu](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@Kan\_Wu](https://community.gatling.io/u/Kan_Wu)\
**Post date:** [January 23, 2014, 11:24pm UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/13 "2014-01-23T23:24:13Z")

</div>

what do you mean by populations? i think i only have one population if you mean scenario. this is the old code, which does not work:

setUp(scn.inject(rampUsers(Properties.sessions).over(Properties.rampUp minutes))  
.throttle(jumpToRps(20), holdFor(5 seconds), reachRps(100) in (20 seconds), holdFor(1200 seconds)))  
.protocols(httpConf)

This is the new code that works fine:

setUp(scn.inject(rampUsers(Properties.sessions).over(Properties.rampUp minutes)))  
.throttle(jumpToRps(20), holdFor(10 seconds), reachRps(100) in (20 seconds), holdFor(1200 seconds))  
.protocols(httpConf)

be careful about the bracket location, that made the trick.

在 2014年1月23日星期四UTC-8下午3时17分03秒，Stéphane Landelle写道：

---

<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:** [January 24, 2014, 9:15am UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/14 "2014-01-24T09:15:09Z")

</div>

> what do you mean by populations? i think i only have one population if you  
> mean scenario.

Yep, that's what I mean.

> this is the old code, which does not work:
> 
> setUp(scn.inject(rampUsers(Properties.sessions).over(Properties.rampUp  
> minutes))  
> .throttle(jumpToRps(20), holdFor(5 seconds), reachRps(100) in (20  
> seconds), holdFor(1200 seconds)))  
> .protocols(httpConf)
> 
> This is the new code that works fine:
> 
> setUp(scn.inject(rampUsers(Properties.sessions).over(Properties.rampUp  
> minutes)))  
> .throttle(jumpToRps(20), holdFor(10 seconds), reachRps(100) in (20  
> seconds), holdFor(1200 seconds))  
> .protocols(httpConf)
> 
> be careful about the bracket location, that made the trick.

So that's a bug...  
If you have only one population, setting the throttling globally or on the  
population should produce the same result. Will investigate.  
Thanks for your feedback.

---

<div class="post-metadata">

**Author:** ![Amit](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Amit](https://community.gatling.io/u/Amit)\
**Post date:** [September 29, 2014, 1:08pm UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/15 "2014-09-29T13:08:41Z")

</div>

Hi,

Came across this post and was wondering where it stands…? 🙂  
I’m also in need to control throttling per scenario, and not per simulation.

Thanks

---

<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:** [September 29, 2014, 1:12pm UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/16 "2014-09-29T13:12:40Z")

</div>

Hi,

It has been implemented for quite a long time, and documented too 😉  
[http://gatling.io/docs/2.0.0-RC5/general/scenario.html?highlight=throttling#throttling](http://gatling.io/docs/2.0.0-RC5/general/scenario.html?highlight=throttling#throttling)

---

<div class="post-metadata">

**Author:** ![Mr\_Lewis](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@Mr\_Lewis](https://community.gatling.io/u/Mr_Lewis)\
**Post date:** [September 29, 2014, 2:44pm UTC](https://community.gatling.io/t/scenarios-throughput-configuration/774/17 "2014-09-29T14:44:00Z")

</div>

Hi Amit,

The constant throughput timer in JMeter determines the constant throughput per second.

I achieve this in Gatling by using the inject method:  
[https://github.com/gatling/gatling/blob/master/src/sphinx/general/simulation\_setup.rst#injection](https://github.com/gatling/gatling/blob/master/src/sphinx/general/simulation_setup.rst#injection)

Aidy
