JVM args issue with gatling maven plugin

Hi All,

I was trying to put some custom jvm arguments e.g.

io.gatling gatling-maven-plugin **2.0.0-M3a** test execute ... itemstore.simulations.StandaloneProductSimulation -Xms1024m -Xmx4096m ...

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 jvmArgs() {
List jvmArguments = (jvmArgs != null) ? jvmArgs : new ArrayList();
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 jvmArgs() {
List jvmArguments = (jvmArgs != null) ? jvmArgs : new ArrayList();
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

Hi,

This has already been fixed in master: https://github.com/excilys/gatling-maven-plugin/blob/master/src/main/java/io/gatling/mojo/GatlingMojo.java#L257

FYI, how JVM are picked is not specified, you cannot rely on this.

Cheers,

Stéphane

Thanks Stephane! Appreciate quick help, and you’re right about JVM agrs order.

Thanks,
Sandeep

You’re welcome!

If you plan on using the plugin snapshot, beware, it’s only compatible with Gatling modules snapshots.