memory setting for the maven gatling plugin

I am using the maven gatliing plug in. One of my tests needs to use bigger memory which was fine when I use the command line:

JAVA_OPTS="-server -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms512M -Xmx4096M -Xmn100M -XX:+HeapDumpOnOutOfMemoryError -XX:+AggressiveOpts -XX:+OptimizeStringConcat -XX:+UseFastAccessorMethods -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly ${JAVA_OPTS}"

CLASSPATH="$GATLING_HOME/lib/*:$GATLING_CONF:$GATLING_HOME/user-files:${JAVA_CLASSPATH}"

java $JAVA_OPTS -cp $CLASSPATH io.gatling.app.Gatling $@

I changed the Xmx to 4096 and it works fine.

But the same tests, when I used the maven plugin, I tried different ways to set the Xmx

  1. export MAVEN_OPTS=-Xmx4096m

  2. change the pom:

    -Xmx4096m

  3. use java and add the java opt.

All of then gives me the OOM. Seems like the memory does not get changed.

Any advices?

Thx
Shawna

I am using the version: 2.0.0-M3a

What kind of OOM do you get? OOM doesn’t necessarily mean a heap problem, could as well be the permgen.
stacktrace, please?

I am getting this:

java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid12583.hprof ...
Heap dump file created [445043187 bytes in 3.202 secs]
Uncaught error from thread [GatlingSystem-akka.actor.default-dispatcher-3] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[GatlingSystem]
java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:2271)
	at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:113)
	at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
	at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:140)
	at java.io.OutputStream.write(OutputStream.java:75)
	at com.jivesoftware.cloudalytics.util.SnappyUtils.combine(SnappyUtils.java:37)
	at com.jivesoftware.cloudalytics.util.SnappyUtils.snappyCompress(SnappyUtils.java:44)
	at com.jivesoftware.cloudalytics.performance.CloudalyticsPerfTestDataUtils.convertToPostStringEntity(CloudalyticsPerfTestDataUtils.java:42)
	at cloudalytics.atom.EventUtils$$anonfun$1.apply(EventUtils.scala:30)
	at cloudalytics.atom.EventUtils$$anonfun$1.apply(EventUtils.scala:27)
	at io.gatling.core.action.SessionHook.executeOrFail(SessionHook.scala:35)
	at io.gatling.core.action.Failable$class.execute(Actions.scala:82)
	at io.gatling.core.action.SessionHook.execute(SessionHook.scala:28)
	at io.gatling.core.action.Action$$anonfun$receive$1.applyOrElse(Actions.scala:42)
	at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:166)
	at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425)
	at akka.actor.ActorCell.invoke(ActorCell.scala:386)
	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230)
	at akka.dispatch.Mailbox.run(Mailbox.scala:212)
	at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506)
	at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
	at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
	at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
	at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

The OOM happens to one of our libraries. But when I bump up the memory in the “gatling command line” it started working. For maven plugin, when I tried to bump up it still does not work

I also tried it on 2.0.0-SNAPSHOT, got the same OOM…

I am checking this:

https://gatling.ci.cloudbees.com/job/gatling-maven-plugin/ws/src/main/java/io/gatling/mojo/GatlingMojo.java/view/

public static final String[] JVM_ARGS = new String[] { "-server", "-XX:+UseThreadPriorities", "-XX:ThreadPriorityPolicy=42", "-Xms512M", "-Xmx512M", "-Xmn100M", "-Xss2M",
	        "-XX:+HeapDumpOnOutOfMemoryError", "-XX:+AggressiveOpts", "-XX:+OptimizeStringConcat", "-XX:+UseFastAccessorMethods", "-XX:+UseParNewGC", "-XX:+UseConcMarkSweepGC",
	        "-XX:+CMSParallelRemarkEnabled", "-XX:+CMSClassUnloadingEnabled", "-XX:CMSInitiatingOccupancyFraction=75", "-XX:+UseCMSInitiatingOccupancyOnly", "-XX:SurvivorRatio=8",
	        "-XX:MaxTenuringThreshold=1" };
private List<String> jvmArgs() {
		List<String> jvmArguments = (jvmArgs != null) ? jvmArgs : new ArrayList<String>();
		jvmArguments.addAll(Arrays.asList(JVM_ARGS));
		return jvmArguments;
	}

Seems like the default JVM_ARGS get written to the jvmArgs anyhow.  Even I specified the Xmx in the pom?

seem

Ouch.

In most JVM I know, in case of duplicates, the last options take precedence, which is exactly the opposite that we want. However, this is very JVM dependent and we’d better completely override.

Will fix.

Fixed. https://github.com/excilys/gatling/issues/1628

Note that the gatling maven plugin snapshots are also deployed on Sonatype (https://oss.sonatype.org/content/repositories/snapshots/io/gatling/gatling-maven-plugin).

The snapshot works. Thx for the quick response!

Hi,

Was wondering if this particular fix would be back-ported to gatling-maven-plugin 1.5.3 ? (I seem to be getting OOM errors regardless the -Xmx4096m setting.
And, I don’t think I am inadvertently hanging on to anything in the actual scenario that gets run, for example.

I’d also guess that gatling-maven-plugin 2.0.0-SNAPSHOT is incompatible with Gatling 1.5.3?

thanks!
Ryan

I’ll have to check, but I thing the maven plugin is backward compatible so far. The version was upgraded because of the groupId change.
I can release a 1.5.4 beginning of next week. Please ping me, I’ll probably forgot.

thank you much Stéphane.

I will ping you next week. have had sporadic OOMs, if it gets urgent then I will try out gatling-maven-plugin 2.0.0-SNAPSHOT.

Ryan

Weird.
Do you have any idea about the origin of those OOM? If you migrate to Gatling 2M4 someday (once it is released of course) and you still get those, I’d gladly have a look at the heap dump.

What exactly do I need to do to get this working? This is my pom, and I’m just not getting anywhere. I’d prefer bumping up to 4g, but I’m stuck at 500m

4.0.0

io.gatling
gatling-maven-plugin-demo
2.0.0-SNAPSHOT
jar

local
local Repository
file:///home/twc-user/.m2/repository


excilys
Excilys Repository
http://repository.excilys.com/content/groups/public

excilys Excilys Repository http://repository.excilys.com/content/groups/public excilys-snapshot Excilys Repository Snapshot https://oss.sonatype.org/content/repositories/snapshots UTF-8 2.0.0-SNAPSHOT io.gatling.highcharts gatling-charts-highcharts ${gatling.version} test

org.scala-lang
scala-compiler
2.10.3


io.fastjson
boon
0.7

io.gatling gatling-maven-plugin 2.0.0-SNAPSHOT test execute -Xmx4g <!--src/test/resources src/test/resources/data target/gatling/results src/test/resources/request-bodies src/test/scala **/*.scala



advanced/*.scala







Hi Spencer,

Our snapshots are now on Sonatype (and releases will be on central).
You still target Excilys’ repository so you get an old old snapshot.

You have to configure the Sonatype snapshot one: https://oss.sonatype.org/content/repositories/snapshots/

Cheers,

Stéphane

Man, I hate maven.

I’ll get that fixed up tomorrow. I bet it’ll work like a champ.

Thanks so much!

That was partially the culprit.

The other culprit was the configuration block should not have been in the executions block.

It’d be nice if maven failed on stuff like that.

No comment…

I spent 1h yesterday trying to release a maven project.

Deploy was failing because some plugin didn’t have a fixed version (no idea which one), was automatically upgraded, and didn’t work properly with the other ones…