Question

I'm trying to pass correct JVM arguments to my play 2.2.1 application deployed on Heroku but there is a problem.

My Procfile looks like this:

web: target/universal/stage/bin/myapp -Dhttp.port=${PORT} -Dconfig.file=conf/production.conf -J-javaagent:lib/heroku-javaagent-1.4.jar=stdout=true,lxmem=true -J-javaagent:lib/newrelic.jar -J-Dnewrelic.config.file=lib/newrelic.yml

In this article (https://devcenter.heroku.com/articles/play-support) it says that PLAY_OPTS is not needed to be passed because it is read by the generated script. However, in my app, at runtime I read the JVM arguments and they look like this:

JVM value: -Djava.rmi.server.useCodebaseOnly=true
JVM value: -Xms1024m
JVM value: -XX:MaxPermSize=256m
JVM value: -XX:ReservedCodeCacheSize=128m
JVM value: -Duser.dir=/app/target/universal/stage
JVM value: -Dhttp.port=57279
JVM value: -javaagent:lib/heroku-javaagent-1.4.jar=stdout=true,lxmem=true
JVM value: -Xmx1024m
JVM value: -javaagent:lib/newrelic.jar
JVM value: -Dnewrelic.config.file=lib/newrelic.yml
JVM value: -Dconfig.file=conf/production.conf

So the "JAVA_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops" isn't read by the script apparently.

I also tried to append -Xmx384m -Xss512k -XX:+UseCompressedOops to Procfile but again, it didn't work.

How can I make this work?

Was it helpful?

Solution

The problem was that the generated play script reads the lowercase "java_opts" instead of "JAVA_OPTS".

So if you set java_opts variable, it will work:

heroku config:set java_opts="-Xms128m -Xmx384m -Xss512k -XX:+UseCompressedOops"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top