Strange behavior when running gatling simulation twice

Hi all,

I’m observing a very strange behavior of my gatling simulation. I try to explain with some shortend code:

I call the simulation from a webservice:

`

public void startGatlingSimulation(@RequestParam String simulationName) {
  logger.info("Starting gatling simulation {}", simulationName);

  String simulationClass = Properties.propOrElse("gatling.simulationClass", "xx.xx.xx." + simulationName);

  GatlingPropertiesBuilder propertiesBuilder = new GatlingPropertiesBuilder();
  propertiesBuilder.simulationClass(simulationClass);
  
  Gatling.fromMap(propertiesBuilder.build());
}

`

now the simulation is executed as expected.

But:
Later I call the webservice method again, I see in the debugger this code is passed, but the simulation is not executed correctly.
It seems to be concerned with the feeder.

Here some more code:
simulation class:

`

Hi,

The core issue is that your trying to embed Gatling, and Gatling is not intended to be used this way, for good reasons.
When you run a load test, you really want to have dedicated resources (CPU, IO, memory) so you get consistent results.
You don’t want to have screwed results because another heavy process randomly happens to share the same resources, all the less sharing the same JVM.

Gatling is built with such usage in mind, so every load test execution happens in its own one shot JVM process.
As a consequence, we provide launchers work this way: scripts for the bundle, and maven and sbt plugins for structured projects.

What you’re trying to build is not supported, so well, appart from the fact we believe it’s wrong, you’re in uncharted lands and it’s no surprise it doesn’t work.

Regards,

Hi Stephane,

thank you for your reply.
The idea is as follows:
We have one very simple application A in containing the gatling files mentioned above. From the simulation (in application A) we want to load test application B on another server.
(so there will be no mixup).
The problem now is that after the first run we have to restart the application A to be able to start the load test again.
So we do not embed gatling in the application B, only in application A to trigger the run.

Do not embed Gatling, really.
Gatling is a software, not a library.