0
votes

I'm experiencing a couple of problems while trying to run a Gatling simulation I've done. basically, I have two problems:

  1. When any API under test in the Gatling simulation returns 400 or any other error code (not part of the check.status), Gatling kills the virtual user, instead of restarting the scenario and re-use that virtual user, so per each error, I'm losing a virtual user, as my test was planned only with 16 users for 30 mins, I'm having finished the test in the first few minutes without completing anything It happens every time I try to run the test and is annoying as I've been following all the documentation and I don't know what do I have wrong on the code. The simulation config for the users and ramp looks like the next code:
    val scnCreation = scenario("My Scenario").during(conf.getDuration("test.duration")) {
        exec(Pattern.methodToExecute)
    }

    setUp(scnCreation.inject(
        rampUsers(conf.getInt("test.vu")).during(conf.getDuration("test.ramp"))
    )
  1. I'm getting this error while the test is running, but my resources are not overwhelmed (CPU is about ~30% and memory is about ~50%):

    [gatling-http-1-13] WARN io.netty.channel.nio.NioEventLoop - Selector.select() returned prematurely 512 times in a row;

Any ideas on how to increase the "limits" of the Gatling engine and how to fix that bad-behavior in which Gatling kills one virtual user after an error?

1

1 Answers

0
votes
  1. Your statement that, on error, virtual users escape your loop and terminate is most likely wrong, unless you've implemented your test this way with some exit condition (edit: you did).

If you don't want your users to exit your loop, don't use exitHereIfFailed. Wrap your loop content with exitBlockOnFail instead. Have a look at the documentation.

Then, in any case, Gatling doesn't "recycle" virtual users. You're using rampUsers which defines an open workload model where you define the arrival rate of your users.

  1. This is a NIO/OS bug. Upgrade your Java to the latest release of Java 8 at least, and if you're running on Linux, check how old your kernel is and most likely consider upgrading.

Also, I suspect you're using an old version of Gatling as modern ones don't use Java NIO on Linux. You should upgrade (latest is 3.5.1 as of now)