error attempting to configure javaOptions via gatling sbt plugin.

Hello,

I am getting an OOME while Gatling is generating it’s report. I’d like to increase the heap to stop this.

A previous thread suggested

import io.gatling.sbt.utils.PropertyUtils._
javaOptions in Gatling := …

However this gives

error: not found: value Gatling

javaOptions in Gatling := …

Any input would be appreciated.

Thanks

Jono

my configuration is as follows:

sbt.version=0.13.8

~~~ plugin.sbt

addSbtPlugin("io.gatling" % "gatling-sbt" % "2.1.0")

~~~ build.scala

name := "gatling"

version := "0.0.1"

scalaVersion := "2.11.6"

scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8",
"-unchecked", // Enable additional warnings where generated code depends on assumptions
"-feature",
"-language:implicitConversions",
"-language:postfixOps",
"-Xlint", // Enable recommended additional warnings.
"-Xfatal-warnings",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xfuture"
)

resolvers ++= Seq(
"Java.net Maven2 Repository" at "http://download.java.net/maven/2/",
"Sonatype scala-tools repo" at "https://oss.sonatype.org/content/groups/scala-tools/",
"Sonatype scala-tools releases" at "https://oss.sonatype.org/content/repositories/releases",
"Sonatype scala-tools snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
)

libraryDependencies ++= Seq(
"org.scalaz" %% "scalaz-core" % "7.1.0",
"io.gatling.highcharts" % "gatling-charts-highcharts" % "2.1.4",
"io.gatling" % "gatling-test-framework" % "2.1.4"
)

parallelExecution in Test := false

// Remove Java directories, otherwise sbteclipse generates them
unmanagedSourceDirectories in Compile <<= (scalaSource in Compile)(Seq(_))

unmanagedSourceDirectories in Test <<= (scalaSource in Test)(Seq(_))

enablePlugins(GatlingPlugin)

import io.gatling.sbt.utils.PropertyUtils._
javaOptions in Gatling := List(
"-server", "-XX:+UseThreadPriorities", "-XX:ThreadPriorityPolicy=42", "-Xms512M",
"-Xmx2512M", "-Xmn100M", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:+AggressiveOpts",
"-XX:+OptimizeStringConcat", "-XX:+UseFastAccessorMethods", "-XX:+UseParNewGC",
"-XX:+UseConcMarkSweepGC", "-XX:+CMSParallelRemarkEnabled") ++ propagatedSystemProperties

HI Jonathan,

You’re missing an (unfortunately) necessary import.

Add “import io.gatling.sbt.GatlingPlugin._” and it should be fine :slight_smile:

Please note that with the upcoming Gatling 2.1.5 release, you will not need those imports anymore and you’ll be able to rewrite it as :

javaOptions in Gatling := overrideDefaultJavaOptions("-Xmx2512m")

Cheers,

Pierre

Excellent!

Thanks for the quick reply.

Cheers
Jono

Hi Pierre,

Many thanks for the work on the sbt plugin. Would it possible to document the changes to the plugin in the upcoming release as I have been watching the commits and noticed quite a few.

Aidy

Hi Aidy,

You’re welcome :slight_smile:
This has been done already :wink: : https://github.com/gatling/gatling/commit/8336b8660bb3484943b746ac3e319499e86cd5b5

Cheers,

Pierre