# memory setting for the maven gatling plugin

**URL:** <https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802>\
**Category:** Gatling (Open-Source)\
**Created:** [February 3, 2014, 8:44pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802 "2014-02-03T20:44:47Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shawna](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@Shawna](https://community.gatling.io/u/Shawna)\
**Post date:** [February 3, 2014, 8:44pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/1 "2014-02-03T20:44:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Shawna](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@Shawna](https://community.gatling.io/u/Shawna)\
**Post date:** [February 3, 2014, 8:45pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/2 "2014-02-03T20:45:28Z")

</div>

I am using the version: 2.0.0-M3a

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [February 3, 2014, 10:07pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/3 "2014-02-03T22:07:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Shawna](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@Shawna](https://community.gatling.io/u/Shawna)\
**Post date:** [February 3, 2014, 11:11pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/4 "2014-02-03T23:11:37Z")

</div>

I am getting this:

```auto
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)

```

---

<div class="post-metadata">

**Author:** ![Shawna](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@Shawna](https://community.gatling.io/u/Shawna)\
**Post date:** [February 3, 2014, 11:31pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/5 "2014-02-03T23:31:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Shawna](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@Shawna](https://community.gatling.io/u/Shawna)\
**Post date:** [February 4, 2014, 3:08am UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/6 "2014-02-04T03:08:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Shawna](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@Shawna](https://community.gatling.io/u/Shawna)\
**Post date:** [February 4, 2014, 4:41am UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/7 "2014-02-04T04:41:27Z")

</div>

I am checking this:

[https://gatling.ci.cloudbees.com/job/gatling-maven-plugin/ws/src/main/java/io/gatling/mojo/GatlingMojo.java/](https://gatling.ci.cloudbees.com/job/gatling-maven-plugin/ws/src/main/java/io/gatling/mojo/GatlingMojo.java/)_view_/

```auto
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" };

```

```auto
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

```

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [February 4, 2014, 6:11am UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/8 "2014-02-04T06:11:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [February 4, 2014, 6:17am UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/9 "2014-02-04T06:17:13Z")

</div>

Fixed. [https://github.com/excilys/gatling/issues/1628](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](https://oss.sonatype.org/content/repositories/snapshots/io/gatling/gatling-maven-plugin)).

---

<div class="post-metadata">

**Author:** ![Shawna](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@Shawna](https://community.gatling.io/u/Shawna)\
**Post date:** [February 5, 2014, 5:50pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/10 "2014-02-05T17:50:33Z")

</div>

The snapshot works. Thx for the quick response!

---

<div class="post-metadata">

**Author:** ![Ryan\_Monaghan](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@Ryan\_Monaghan](https://community.gatling.io/u/Ryan_Monaghan)\
**Post date:** [February 14, 2014, 2:32am UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/11 "2014-02-14T02:32:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [February 14, 2014, 6:38am UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/12 "2014-02-14T06:38:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ryan\_Monaghan](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@Ryan\_Monaghan](https://community.gatling.io/u/Ryan_Monaghan)\
**Post date:** [February 14, 2014, 7:21pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/13 "2014-02-14T19:21:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [February 14, 2014, 8:19pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/14 "2014-02-14T20:19:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Spencer\_Chastain](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Spencer\_Chastain](https://community.gatling.io/u/Spencer_Chastain)\
**Post date:** [March 25, 2014, 7:46pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/15 "2014-03-25T19:46:29Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 25, 2014, 8:42pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/16 "2014-03-25T20:42:26Z")

</div>

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/](https://oss.sonatype.org/content/repositories/snapshots/)

Cheers,

Stéphane

---

<div class="post-metadata">

**Author:** ![Spencer\_Chastain](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Spencer\_Chastain](https://community.gatling.io/u/Spencer_Chastain)\
**Post date:** [March 26, 2014, 12:40am UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/17 "2014-03-26T00:40:46Z")

</div>

Man, I hate maven.

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

Thanks so much!

---

<div class="post-metadata">

**Author:** ![Spencer\_Chastain](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Spencer\_Chastain](https://community.gatling.io/u/Spencer_Chastain)\
**Post date:** [March 26, 2014, 4:25pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/18 "2014-03-26T16:25:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [March 26, 2014, 4:34pm UTC](https://community.gatling.io/t/memory-setting-for-the-maven-gatling-plugin/802/19 "2014-03-26T16:34:24Z")

</div>

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…
