memory setting for the maven gatling plugin

2,942 views
Skip to first unread message

Shawna Qian

unread,
Feb 3, 2014, 3:44:47 PM2/3/14
to gat...@googlegroups.com
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: <configuration>
                                <jvmArgs>
                                    <jvmArg>-Xmx4096m</jvmArg>
                                </jvmArgs>
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

Shawna Qian

unread,
Feb 3, 2014, 3:45:28 PM2/3/14
to gat...@googlegroups.com
I am using the version: 2.0.0-M3a

Stéphane Landelle

unread,
Feb 3, 2014, 5:07:04 PM2/3/14
to gat...@googlegroups.com
What kind of OOM do you get? OOM doesn't necessarily mean a heap problem, could as well be the permgen.
stacktrace, please?


2014-02-03 Shawna Qian <shawn...@gmail.com>
I am using the version: 2.0.0-M3a

--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Shawna Qian

unread,
Feb 3, 2014, 6:11:37 PM2/3/14
to gat...@googlegroups.com

 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)

Shawna Qian

unread,
Feb 3, 2014, 6:31:53 PM2/3/14
to gat...@googlegroups.com
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

Shawna Qian

unread,
Feb 3, 2014, 10:08:15 PM2/3/14
to gat...@googlegroups.com
I also tried it on 2.0.0-SNAPSHOT, got the same OOM....

Shawna Qian

unread,
Feb 3, 2014, 11:41:27 PM2/3/14
to gat...@googlegroups.com
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

Stéphane Landelle

unread,
Feb 4, 2014, 1:11:17 AM2/4/14
to gat...@googlegroups.com
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.


2014-02-04 Shawna Qian <shawn...@gmail.com>

Stéphane Landelle

unread,
Feb 4, 2014, 1:17:13 AM2/4/14
to gat...@googlegroups.com


2014-02-04 Stéphane Landelle <slan...@excilys.com>

Shawna Qian

unread,
Feb 5, 2014, 12:50:33 PM2/5/14
to gat...@googlegroups.com
The snapshot works.  Thx for the quick response!

Ryan Monaghan

unread,
Feb 13, 2014, 9:32:29 PM2/13/14
to gat...@googlegroups.com
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 <jvmArg>-Xmx4096m</jvmArg> 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

Stéphane Landelle

unread,
Feb 14, 2014, 1:38:55 AM2/14/14
to gat...@googlegroups.com
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.


--

Ryan Monaghan

unread,
Feb 14, 2014, 2:21:14 PM2/14/14
to gat...@googlegroups.com
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

Stéphane Landelle

unread,
Feb 14, 2014, 3:19:28 PM2/14/14
to gat...@googlegroups.com
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.

Spencer Chastain

unread,
Mar 25, 2014, 3:46:29 PM3/25/14
to gat...@googlegroups.com

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


    <modelVersion>4.0.0</modelVersion>

    <groupId>io.gatling</groupId>
    <artifactId>gatling-maven-plugin-demo</artifactId>
    <version>2.0.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <repositories>
        <repository>
            <id>local</id>
            <name>local Repository</name>
            <url>file:///home/twc-user/.m2/repository</url>
        </repository>
        <repository>
            <id>excilys</id>
            <name>Excilys Repository</name>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>excilys</id>
            <name>Excilys Repository</name>
        </pluginRepository>
        <pluginRepository>
            <id>excilys-snapshot</id>
            <name>Excilys Repository Snapshot</name>
        </pluginRepository>
    </pluginRepositories>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <gatling.version>2.0.0-SNAPSHOT</gatling.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.gatling.highcharts</groupId>
            <artifactId>gatling-charts-highcharts</artifactId>
            <version>${gatling.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-compiler</artifactId>
            <version>2.10.3</version>
        </dependency>
        <dependency>
            <groupId>io.fastjson</groupId>
            <artifactId>boon</artifactId>
            <version>0.7</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>io.gatling</groupId>
                <artifactId>gatling-maven-plugin</artifactId>
                <version>2.0.0-SNAPSHOT</version>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <jvmArgs><jvmArg>-Xmx4g</jvmArg></jvmArgs>
                            <!-- Default values -->
                            <!--<configDir>src/test/resources</configDir>
                            <dataFolder>src/test/resources/data</dataFolder>
                            <resultsFolder>target/gatling/results</resultsFolder>
                            <requestBodiesFolder>src/test/resources/request-bodies</requestBodiesFolder>
                            <simulationsFolder>src/test/scala</simulationsFolder>
                            <includes>
                                <include>**/*.scala</include>
                            </includes>-->
                            <excludes>
                                <exclude>advanced/*.scala</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Stéphane Landelle

unread,
Mar 25, 2014, 4:42:26 PM3/25/14
to gat...@googlegroups.com
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


For more options, visit https://groups.google.com/d/optout.

Spencer Chastain

unread,
Mar 25, 2014, 8:40:46 PM3/25/14
to gat...@googlegroups.com

Man, I hate maven.

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

Thanks so much!



--
You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/4RrQFsbeN8s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.

Spencer Chastain

unread,
Mar 26, 2014, 12:25:52 PM3/26/14
to gat...@googlegroups.com

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.


Stéphane Landelle

unread,
Mar 26, 2014, 12:34:24 PM3/26/14
to gat...@googlegroups.com
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....
Reply all
Reply to author
Forward
0 new messages