KB Article #167507

JVM options - tuning jvm.xml

Problem

-- What are some example options for jvm.xml?

Resolution

* Add the lines below to jvm.xml. Remember that the entire file should be wrapped in a <ConfigurationFragment> element. For more details on the proper location of the jvm.xml file, please refer to KB 167287.


  • Increase JVM memory:

<!-- Additional JVM settings argument that will increase both the min and max memory JVM memory to 1G (1024m) Xms = min Xmx = max -->
<VMArg name="-Xms1024m"/>
<VMArg name="-Xmx1024m"/>


  • Add a jar to the classpath:

<ClassPath name="ext/lib/mymodule.jar"/>

  • Debug the garbage collector:

<VMArg name="-verbose:gc"/> <VMArg name="-XX:+PrintGCDetails"/>
<VMArg name="-XX:+PrintGCTimeStamps"/>
<VMArg name="-XX:+PrintGCApplicationConcurrentTime"/>
<VMArg name="-XX:+PrintGCApplicationStoppedTime"/>
<VMArg name="-Xloggc:/path/to/gc.log" />

  • DNS lookup cache settings

<VMArg name="-Dnetworkaddress.cache.ttl=100"/>

The number of seconds to cache a successful DNS lookup. A value of -1 causes it to cache forever (until JVM restart). The proper setting depends on how often DNS changes are made.

<VMArg name="-Dnetworkaddress.cache.negative.ttl=10"/>

The number of seconds to cache an unsuccessful DNS lookup. A value of -1 causes it to cache forever (until JVM restart).


  • Java proxy settings

<VMArg name="-Dhttp.proxyHost=34.201.57.56"/>
<VMArg name="-Dhttp.proxyPort=1234"/>
<VMArg name="-Dhttp.nonProxyHosts=localhost|127.0.0.1"/>
<VMArg name="-Dhttp.proxyUser=somename"/>
<VMArg name="-Dhttp.proxyPassword=somepassword"/>

  • Add a client keystore for Java-based connections (some non-HTTP traffic):

<!-- Uncomment for debug
<VMArg name="-Djavax.net.debug=all"/>
-->
<VMArg name="-Djavax.net.ssl.keyStore=$VINSTDIR/$DISTRIBUTION/jre/lib/security/client-keystore.jks"/> <VMArg name="-Djavax.net.ssl.keyStorePassword=changeit"/>

  • JVM Debugging:

<!-- Additional JVM settings argument that enables the process to start and wait for a JVM debugger to connect to the process on port 9999 -->
<VMArg name="-Xrunjdwp:transport=dt_socket,server=y,address=9999"/>

  • Additional logging:


<!-- Additional JVM settings to set the location of the -Djava.util.logging.config.file so that custom JVM log settings can be picked up. In this case the logging.properties would need to be placed in the root of the Gateway install -->
<VMArg name="-Djava.util.logging.config.file=logging.properties"/>

  • JSSE debug:

<VMArg name="-Djavax.net.debug=all"/>

Note that OpenSSL is used for most SSL connections (Connection / Connect to URL), so this setting only applies to a few things like LDAPS.

  • Oracle JDBC verbose:

<VMArg name="-Doracle.jdbc.Trace=true"/>

  • UTF8 encoding:

<VMArg name="-Dfile.encoding=UTF-8"/>