Hi All,
I was trying to put some custom jvm arguments e.g.
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>2.0.0-M3a</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
<configuration>
...
<simulationClass>itemstore.simulations.StandaloneProductSimulation</simulationClass>
<jvmArgs>
<jvmArg>-Xms1024m</jvmArg>
<jvmArg>-Xmx4096m</jvmArg>
</jvmArgs>
...
but looks like no matter what memory sizes I give here, the simulation code always runs with 512M of min and max memory.
After digging a little deeper (I am using 2.0.0-M3a version of plugin), I found that 512M is default min and max values for heap size.
I looked at the GatlingMojo.java class and the method which builds jvm args is this:
private List<String> jvmArgs() {
List<String> jvmArguments = (jvmArgs != null) ? jvmArgs : new ArrayList<String>();
jvmArguments.addAll(Arrays.asList(JVM_ARGS));
return jvmArguments;
}
Now, since we're adding default properties in an array list to the existing jvmArgs, the -Xms and _Xmx will be added twice. The final list would look something like "... -Xms1024M ... -Xms512M ..."
In this scenario, looks like JVM is picking up the rightmost arg value and hence ignoring my custom options.
Is this a bug?
May be the code should have been:
private List<String> jvmArgs() {
List<String> jvmArguments = (jvmArgs != null) ? jvmArgs : new ArrayList<String>();
Arrays.asList(JVM_ARGS).addAll(jvmArguments) // reverse order:
return jvmArguments;
}
Or may be we could have used a Set (in the same order, custom first, defaults later) to make sure that properties are not overridden by default.
Thanks,
Sandeep