Landon Kuhn Landon Kuhn - 1 month ago 13
Java Question

How to set JVM maximum heap memory for Apache Ignite v1.7?

How do I set the maximum heap memory available to Apache Ignite when running via

ignite.sh
? The docs do not seem to cover this very basic task. Also, how do I verify that the setting is actually working?

I have read that the command line option
-J
is available for passing JVM arguments from
ignite.sh
to the JVM process, but am unable to find evidence it is actually working. For example, if I start Ignite as follows:

bin/ignite.sh -v -J-Xmx2g


The program outputs the following message:

[09:13:42,422][INFO][main][IgniteKernal] VM arguments: [-Xms1g, -Xmx1g, -XX:+AggressiveOpts, -XX:MaxPermSize=256m, -DIGNITE_QUIET=false, -DIGNITE_SUCCESS_FILE=/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin/work/ignite_success_5d0c3958-8952-4a7d-81b0-76c07ae6c520, -Dcom.sun.management.jmxremote, -Dcom.sun.management.jmxremote.port=49164, -Dcom.sun.management.jmxremote.authenticate=false, -Dcom.sun.management.jmxremote.ssl=false, -DIGNITE_HOME=/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin, -DIGNITE_PROG_NAME=bin/ignite.sh, -Xmx2g]


Which seems to suggest both
-Xmx1g
and
-Xmx2g
are being passed.

Also,
ps aux
shows the following:

landon 47582 1.0 2.1 5214944 172616 s000 S+ 9:13AM 0:06.19 /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java -Xms1g -Xmx1g -server -XX:+AggressiveOpts -XX:MaxPermSize=256m -DIGNITE_QUIET=false -Xdock:name=Ignite Node -DIGNITE_SUCCESS_FILE=/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin/work/ignite_success_5d0c3958-8952-4a7d-81b0-76c07ae6c520 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=49164 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -DIGNITE_HOME=/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin -DIGNITE_PROG_NAME=bin/ignite.sh -Xmx2g -cp /Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin/libs/*:/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin/libs/ignite-indexing/*:/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin/libs/ignite-spring/*:/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin/libs/licenses/* org.apache.ignite.startup.cmdline.CommandLineStartup config/default-config.xml
landon 45624 0.0 0.0 3166752 1292 ?? S Fri07PM 0:00.01 /bin/bash bin/ignite.sh -v -J-Xmx2g


Which ambiguously lists both
-Xmx1g
and
-Xmx2g
on the command line.

Answer

This is the correct way to set heap memory. If Xmx is listed twice, JVM will use the last one.