The number of users must be a strictly positive value...

Am seeing the following exception:

`

Exception in thread “main” java.lang.IllegalArgumentException: requirement failed: The number of users must be a strictly positive value

at scala.Predef$.require(Predef.scala:219)

at io.gatling.core.controller.inject.RampInjection.(InjectionStep.scala:41)

at io.gatling.core.controller.inject.ConstantRateInjection.(InjectionStep.scala:56)

at io.gatling.core.controller.inject.InjectionSupport$ConstantRateBuilder.during(InjectionSupport.scala:29)

at com.cigna.rtde.client.ClientBehavior$class.perHour(ClientBehavior.scala:31)

at com.cigna.rtde.client.AppsAndActivities$.perHour(AppsAndActivities.scala:11)

at com.cigna.rtde.client.AppsAndActivities$.behavior(AppsAndActivities.scala:21)

at com.cigna.rtde.simulation.ProductionSimulation.(ProductionSimulation.scala:16)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

at io.gatling.app.Gatling.run(Gatling.scala:90)

at io.gatling.app.Gatling.runIfNecessary(Gatling.scala:73)

at io.gatling.app.Gatling.start(Gatling.scala:63)

at io.gatling.app.Gatling$.start(Gatling.scala:51)

at io.gatling.app.Gatling$.fromArgs(Gatling.scala:43)

at io.gatling.app.Gatling$.main(Gatling.scala:37)

at io.gatling.app.Gatling.main(Gatling.scala)

`

My simulation includes a number of individual scenarios being run concurrently. I have a “baseline” per-hour rate, and a “multiplier” (so we can evaluate the impact as the traffic grows). I implemented it something like this:

`
perHour(multiplier,perHourRate,scenario),…

`

The definition of perHour is:

`

def perHour(

multiplier: Double,

rate: Double,

flow: ScenarioBuilder

) =

flow.inject(

rampUsersPerSec( 1.0 / 3600.0 )

to ( rate * multiplier / 3600.0 )

during ( Test.rampTime )

randomized,

constantUsersPerSec( rate * multiplier / 3600.0 )

during ( Test.duration )

randomized

)

`

Rate is a positive number, in this case “6”. Multiplier is a positive number, “1.0”. So we are passing ( 1.0 * 6.0 / 3600.0 ) or ( 0.001666 ) to the to() method, and the constantUsersPerSec() method. One of them is not doing the right thing.

NOTE: I modified “multiplier” to be 10, and the problem goes away. It appears to be some kind of rounding problem.

No, the issue is with your “constantUsersPerSec”.
It’s actually turned into “rampUser” and it doesn’t support injecting less than one user per second.

That’s a fundamental problem for me, unless a workaround can be had. How do I sustain a low-frequency user injection rate?

So, I appear to be able to work around it by just using rampUser with the same From and To values. Could this just be a problem with not using full precision throughout the calculations? Or some kind of rounding error? Because it seemed to work with 60/3600 but not 6/3600.