Grouping requests to simulate a page load

Hi -
I am new to gatling (and scala world) and liking it so far.

I see https://github.com/excilys/gatling/wiki/Structure-Elements#wiki-group says there is support for it but I am having a difficult time figuring out how to use it. So my understanding is that a group contains a chain or chains of requests. Where would it fit in my scenario?

scenario(“a scenario”)
.exec( chain_0, chain_1, chain_2 )

with each chain containing a series of requests.

A group then is

.group(“group 1”){
chain_0, chain_1
}

but where exactly do I put that?

Please a sample snippet on how to use that will be helpful.

Thanks in advance.

Hi,

The doc says it takes a chain, not chains. You can combine chains into a single one with exec.

.group(“group 1”){
exec(chain_0, chain_1)
}

for example:

val scn = scenario(“myScenario”)
.exec(req1)
.group(“myGroup”) {
exec(req2)
.exec(req3)
}.exec(req4)

or

val chain1 = exec(req2).exec(req3)
val chain 2 = exec(req4).exec(req5)
val scn = scenario(“myScenario”)
.exec(req1)
.group{
exec(chain1, chain2)
}.exec(req6)

OK?

Stéphane

Thank you Stephane. That makes sense and works!

Also, exec() can take no argument correct? So if I already have all my requests grouped in a series of chains, then to kick off, I am doing…

val chain1 = exec(req2).exec(req3)
val chain 2 = exec(req4).exec(req5)
val scn = scenario(“myScenario”)
.exec()
.group{
exec(chain1, chain2)
}.exec(req6)

That works but wanted to clarify it was valid and legal to do so.

Thanks again

That shouldn’t be legal.

Why don’t you simply write:

val chain1 = exec(req2).exec(req3)
val chain 2 = exec(req4).exec(req5)
val scn = scenario(“myScenario”)

.group{

exec(chain1, chain2)
}.exec(req6)

I can, but didn’t know group could be a direct chain under scenario ;). I’ll modify my simulation to do as you have suggested. The weird thing is that it still worked though :slight_smile:

It will be nice if the DSL cheat is updated to add this in, that way, beginners like me aren’t so confused.

Also, I know there was a thread about the accuracy of grouped requests accumulation and the issue has been closed

https://github.com/excilys/gatling-highcharts/pull/13

From a quick check, it still seems to be way off for me. I am using version 1.4.1.

I’ll double check again and shared the simulation logs with you if that is the case.

We'll update the cheat sheet ASAP.
We'll also add a build for the 1.4.X branch on our Cloudbees CI so you can
get a SNAPSHOT.

Stay tuned.

Ok. Pls update me once the snapshot is ready to grab.

Thanks

Stephen out of urgency and desperation, I am building from source myself. Everything worked fine (or so I thought) when I ran the sample basic simulation until it tries generating the reports.

At this point, I get this error…

Simulation finished.
Simulation successful.
Generating reports…

Exception in thread “main” java.lang.NoClassDefFoundError: com/excilys/ebi/gatling/charts/component/impl/ComponentLibraryImpl
at com.excilys.ebi.gatling.charts.report.ReportsGenerator$.generateFor(ReportsGenerator.scala:45)
at com.excilys.ebi.gatling.app.Gatling.generateReports(Gatling.scala:172)
at com.excilys.ebi.gatling.app.Gatling.start(Gatling.scala:111)
at com.excilys.ebi.gatling.app.Gatling$.fromMap(Gatling.scala:54)
at com.excilys.ebi.gatling.app.Gatling$.runGatling(Gatling.scala:73)
at com.excilys.ebi.gatling.app.Gatling$.main(Gatling.scala:49)
at com.excilys.ebi.gatling.app.Gatling.main(Gatling.scala)
Caused by: java.lang.ClassNotFoundException: com.excilys.ebi.gatling.charts.component.impl.ComponentLibraryImpl
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
… 7 more
Press any key to continue . . .

Peeking into gatling-charts-1.4.2-SNAPSHOT.jar, I see the mentioned file is not there even though it is present in the source. I have attempted a full clean build to no avail. Same thing every time.

I am able to package with success (skipping tests - as some were failing)

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] gatling-parent … SUCCESS [5.216s]
[INFO] gatling-core … SUCCESS [58.035s]
[INFO] gatling-jdbc … SUCCESS [5.007s]
[INFO] gatling-redis … SUCCESS [4.685s]
[INFO] gatling-http … SUCCESS [34.886s]
[INFO] gatling-charts … SUCCESS [35.276s]
[INFO] gatling-metrics … SUCCESS [12.810s]
[INFO] gatling-app … SUCCESS [17.069s]
[INFO] gatling-recorder … SUCCESS [20.082s]
[INFO] gatling-bundle … SUCCESS [5.127s]
[INFO] gatling-maven-plugin … SUCCESS [3.321s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:21.899s
[INFO] Finished at: Thu Jan 10 10:19:03 EST 2013
[INFO] Final Memory: 97M/478M
[INFO] ------------------------------------------------------------------------

Any ideas?

Any help or insight you can offer will be greatly appreciated.

We just uploaded a SNAPSHOT, you can grab it here : https://docs.google.com/uc?id=0Bx_2pq03RPiIenBVbzdpRkxNSVk&export=download

About your build error :
Gatling is splitted in two projects, due to licensing issues : gatling (the one you built) and gatling-highcharts.
the first project contains almost all the code, except the code related to Highcharts and Highstock, the JS libraries we’re using for our charts.
The problem here is that you only built gatling and not gatling-highcharts : your simulation run well but fails at report generation because, essentially, a whole part of the charting engine is missing.

If you want to build Gatling from source, you’ll have to

  • grab both gatling & gatling-highcharts projects source code,
  • build gatling
  • build gatling-highcharts

Wow, that was quick! Thanks Pierre. You guys rock! I’ll give it a spin right now.

Also, thanks for the build info. That is definitely handy info to have for when I need to live on the edge :wink:

I grabbed gatling-highcharts, built it and added it to the lib, and my build version now works to generate the reports as well. Now to test the group accumulation numbers with the build you provided.

Thanks for your prompt response.

I just tried this now and the group accumulation numbers are still off. I have attached the results.

I went through 2 of the groups and tallied the sum of response time for their requests.

Here is what I expect and what the results are showing

Group Excepted Actual
Login 4,250 12,730
Ranking 4,580 14,320

The other 2 groups are off as well.

So my understanding is that

Group tally = sum of all request response times within that group

Please advice.

Thanks

results.zip (597 KB)

The response time of a group is the duration of the execution of that group, i.e. every requests and groups within that group, pauses and every custom exec bloc.
So, it’s not only the sum of the response time of every requests.

Check your simulation if you have pauses that might explain the actual group duration.

Aha! That was it. Those pauses recorded while recording the scenarios.

Things add up nicely now.

Thanks Gregory!

Off topic: Is there a way to view the current state of things as the scenario is running (besides the shell)? It will be helpful to know how many users are currently in the system at any given point.

You can use Graphite as a live reporting backend.

Nicolas - pls do you care to elaborate? How do I do that? Do you have links to share or any form of documentation?

Thanks

Never mind. I see it now. Will try it shortly. Excited!

Thanks

Cool !

I have a bad network right now on my phone, that’s why I was so brief :wink:

Hi Stephane,

I’d tried your example below and it works, but is there a way to have the 1st exec removed? or maybe exclude all of the “request” from the report of gatling? Since I’m only interested with the timing of a group that I have defined instead of all the request being included in the report?

FROM THIS

val chain1 = exec(req2).exec(req3)
val chain 2 = exec(req4).exec(req5)
val scn = scenario(“myScenario”)
.exec(req1)
.group{
exec(chain1, chain2)
}.exec(req6)

TO SOMETHING like this

object Home{
val home = exec(req1) ← WOULD LIKE TO REMOVE THIS BUT IT WON’T WORK

.group(“myGroup”) {
exec(req2)
.exec(req3)
}

}

val scn = scenario(“myScenario”).exe(Home.home)

TIA
-Stan