5

Good day.

I am running a Java Application on AWS Elastic Beanstalk. I have to increase the heapspace, normally I would do so via -Xmx and Xms.

How do I accomplish this on AWS?

I'm deploying it in the most simple way possible - uploading a jarfile and running it. I've already found this solution on here:

Not able to set JVM heap size on AWS Elastic Beanstalk Java SE Platform

Putting a Procfile into a .zip together with my .jar is accepted when deploying but changes nothing. I really am out of ideas, can anyone help?

Axungia_Hominis
  • 145
  • 1
  • 7
  • 1
    Does this answer your question? [Not able to set JVM heap size on AWS Elastic Beanstalk Java SE Platform](https://stackoverflow.com/questions/48990349/not-able-to-set-jvm-heap-size-on-aws-elastic-beanstalk-java-se-platform) – Nowhere Man Oct 07 '20 at 13:30
  • 1
    Hi, thank you for your comment. I've already referenced this thread in my question because I tried setting JAVA_OPTS and putting a procfile to my .jar. This lead to no errors but changed nothing nonetheless. – Axungia_Hominis Oct 07 '20 at 13:32

1 Answers1

8

After trying several different things (.Config file or Procfile in .zip, changing the Serverside JVM's default heap size and Adding JAVA_OPTS to beanstalk configuration) it finally worked out.

Instead of "JAVA_OPTS", simply add "_JAVA_OPTIONS" with the value "-Xmx[size]m" ([size] representing the desired heap size in bytes) to your Beanstalk Environment's Configurations; it's found under "Configuration"->"Software"->"Environment Properties".

I hope this will save someone the time it took me to find out.

Axungia_Hominis
  • 145
  • 1
  • 7
  • I want to pass -Dsun.net.inetaddr.ttl=60 to elasticbeanstalk JAVA 8 SE, is that achieved in the same way? – alext Jan 02 '21 at 11:27
  • I never had to do this. I guess you just have to try, sorry. – Axungia_Hominis Jan 16 '21 at 14:54
  • 3
    For JDK 9+, "JDK_JAVA_OPTIONS" is the recommended variable to use instead of "_JAVA_OPTIONS" https://stackoverflow.com/questions/52986487/what-is-the-difference-between-jdk-java-options-and-java-tool-options-when-using – Travis Carlson Apr 03 '21 at 00:08
  • 1
    I can confirm that _JAVA_OPTIONS with value get picked correctly by the JVM in beanstalk configuration Example: _JAVA_OPTIONS with value -verbose:gc – LMG Jan 12 '22 at 10:52