Gatling 2.0 throttle does not send any requests

506 views
Skip to first unread message

Nikolay Vasilev

unread,
Feb 20, 2015, 12:19:11 PM2/20/15
to gat...@googlegroups.com
I am trying to run simple Gatling scenario with throttle functionality but no requests are sent to the server.

I am using Gatling 2.0.2, Java 1.8.0_25, Maven 3.2.3 (all running on OS X)

My code looks like this:

    object RequestHomePage {
   
     
def apply() = {
         
exec(http("Home Page Request")
           
.get("http://my.page/home")
           
.header("Accept", "application/xml,application/xhtml+xml")
     
}
   
}


   
object HomePage {
   
      val executeScenario
= scenario("Home Page Retrieval")
                                     
exec(RequestHomePage())
   
}


   
class PerformaceSimulation extends Simulation {
   
      val maxResponseTime
= 5000 // milliseconds
     
      val simultaneousUsers
= atOnceUsers(100)
     
      setUp
(HomePage.executeScenario
             
.inject(atOnceUsers(100))
             
.throttle(jumpToRps(1), holdFor(10 seconds))
       
)
       
.protocols(httpProtocol)
       
.assertions(
         
global.responseTime.max.lessThan(maxResponseTime)1
       
)
   
}


The output is the following:

        ================================================================================
       
2015-02-20 16:39:41                                           4s elapsed
       
---- Home Page Retrieval -------------------------------------------------------
       
[##########################################################################]100%
                  waiting
: 0      / active: 0      / done:100  
       
---- Requests ------------------------------------------------------------------
       
> Global                                                   (OK=0      KO=0     )
       
       
================================================================================
   
Simulation finished
   
Parsing log file(s)...
   
Parsing log file(s) done
    java
.lang.reflect.InvocationTargetException
    at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java
.lang.reflect.Method.invoke(Method.java:483)
    at scala_maven_executions
.MainHelper.runMain(MainHelper.java:164)
    at scala_maven_executions
.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
   
Caused by: java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated


Does anyone have idea why would throttle does not send any requests? Thanks

Nikolay Vasilev

unread,
Feb 20, 2015, 12:22:30 PM2/20/15
to gat...@googlegroups.com

Stéphane LANDELLE

unread,
Feb 20, 2015, 12:32:34 PM2/20/15
to gat...@googlegroups.com
There's been several bug fixes regarding throttling since 2.0.2. Please upgrade to 2.1.4.

Stéphane Landelle
Lead developer


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Николай Василев

unread,
Feb 23, 2015, 6:14:22 AM2/23/15
to gat...@googlegroups.com
Hi Stéphane,

 I've updated the dependencies to 
- Gatling, 2.1.4, 
- Scala 2.11.4, 
- Gatling Maven Plugin 2.1.2, 
but there is no change in the behaviour - no requests are being sent...

Any ideas what could be the thing I am doing wrong?
--
Николай Василев

Stéphane LANDELLE

unread,
Feb 23, 2015, 6:23:54 AM2/23/15
to gat...@googlegroups.com
Even without throttling, your scenario wouldn't send any request as there's a dot missing for properly chaining your scenario and your request:

      val executeScenario = scenario("Home Page Retrieval")

              
MISSING DOT HERE -->exec(RequestHomePage())



Stéphane Landelle
Lead developer


Николай Василев

unread,
Feb 23, 2015, 6:58:54 AM2/23/15
to gat...@googlegroups.com
This is not the issue. It was rather bad copy-pasting by my side... Sorry about that. 
What I've reported is simplified version of the code I am actually writing (I can't share it due to copyright restrictions). Anyway, the syntax is not a problem I think. 
If I rewrite the test using feeders, and hitting the same endpoint (without throttling) all works fine. This makes me think that I am doing something wrong with the throttling.   

Stéphane LANDELLE

unread,
Feb 23, 2015, 7:15:12 AM2/23/15
to gat...@googlegroups.com
Can you share a working reproducer, please?

Stéphane Landelle
Lead developer


Nikolay Vasilev

unread,
Feb 23, 2015, 6:14:11 PM2/23/15
to gat...@googlegroups.com
Hi Stéphane,

I am afraid I can't disclose the code I am working on as it is company's property.

I have created simplified example: https://bitbucket.org/nvasilev/labs-gatling-throttling

Short info on the scenarios:
  1. Scenario "Without Throttling" - I am looping over a request for given number of times. If you want to see this example, PerformaceSimulationWithLoop should be defined as simulation class in pom.xml 
  2. Scenario "With Throttling" - I am trying to use 1 user and make it do 10 invocations of a endpoint in interval of 10 seconds (hits per second: 1). The test is doing one call and the test terminates. If you want to see the example running, PerformaceSimulationThrottling should be defined as simulation class in pom.xml
Note: You can run the simulation with: mvn clean install

The strange thing is that the throttling is working, but still not in the way I would expect it. My code at work is similar to this one and it does not request the endpoint even once. 

What is the relation between the number of users and number of requests per second / duration of execution? 
Is it numberOfUsers = rps * (duration seconds)? I am expecting that the users are "reused", is that correct?

Nikolay Vasilev

unread,
Feb 23, 2015, 6:34:15 PM2/23/15
to gat...@googlegroups.com
Small remark - with regard to the throttling case, at work, RetrievePage scenario, has second feeder, which is iterating over users credentials:

val executeScenario = scenario("Retrieve Page Without a Loop")
.feed(users)
.feed(pathParams)
  .exec(Authenticate())
.exec(RequestPage())

The reason to have second feeder with users at work is that there is an authentication step (which I cannot share). The REST endpoint (requested via RequestPage scenario) is accessible only for an authenticated users. The authentication is working correctly, that is why I am trying to figure it out what is wrong with the rest of my code when I am attempting to do throttling...

Stéphane LANDELLE

unread,
Feb 24, 2015, 3:46:07 AM2/24/15
to gat...@googlegroups.com
Please read the documentation: http://gatling.io/docs/2.1.4/general/simulation_setup.html#throttling

Throttle is a bottleneck. You're still in charge of providing sufficient load on a sufficient period.

Stéphane Landelle
Lead developer


Nikolay Vasilev

unread,
Feb 24, 2015, 6:02:13 AM2/24/15
to gat...@googlegroups.com
Hi Stéphane,

Many thanks about the first note on "Throttling" section. 

Now it makes perfect sense and Gatling behaves as expected just using:

.inject(constantUsersPerSec(numberOfUsers) during(loadDuration seconds))

I think for now this will be sufficient for my needs, and throttle(...) method won't be needed. The explanation that it is upper bound was very crucial for getting the whole picture. 

Thank you very much!

Cheers,
Nikolay

vShnu Macha

unread,
Jan 12, 2017, 6:37:08 AM1/12/17
to Gatling User Group
Hi Stephane,

I am having issues in correlation in Gatling script. I have recorded a Gatling script for Microstrategy. Like in HP LR do we have any functions to correlate dynamic values which gets generated? Please let me know.

Thanks!
Vishnu
Reply all
Reply to author
Forward
0 new messages