Chapter 7. Configuring your JBoss EAP server and application The JBoss EAP for OpenShift image is preconfigured for basic use with your Java applications. However, you can configure the JBoss EAP instance inside the image. The recommended method is to use the OpenShift S2I process and set environment variables in Helm charts to tune the JVM. Important Any configuration changes made on a running container will be lost when the container is restarted or terminated. This includes any configuration changes made using scripts that are included with a traditional JBoss EAP installation, for example add-user.sh or the management CLI. It is strongly recommended that you use the OpenShift S2I process, together with environment variables, to make any configuration changes to the JBoss EAP instance inside the JBoss EAP for OpenShift image. 7.1. JVM default memory settings You can use the following environment variables to modify the JVM settings calculated automatically. Note that these variables are only used when default memory size is calculated automatically when a valid container memory limit is defined. Environment variables Description JAVA_INITIAL_MEM_RATIO This environment variable is now deprecated. Corresponds to the JVM argument -XX:InitialRAMPercentage . This is not specified by default and will be removed in a future release. You need to specify --XX:InitialRAMPercentage directly in JAVA_OPTS instead. Note You no longer need to set JAVA_INITIAL_MEM_RATIO=0 to disable automatic computation. Because no default value is provided for this environment variable. JAVA_MAX_MEM_RATIO Environment variable to configure the -XX:MaxRAMPercentage JVM option. Set the maximum heap size as a percentage of the total memory available for the Java VM. The default value is 80%. Setting JAVA_MAX_MEM_RATIO=0 disables this default value. JAVA_OPTS Environment variable to provide additional options to the JVM, for example, JAVA_OPTS=-Xms512m -Xmx1024m Note If you set a value for -Xms , the -XX:InitialRAMPercentage option is ignored. If you set a value for -Xmx , the -XX:MaxRAMPercentage option is ignored. JAVA_MAX_INITIAL_MEM This environment variable is now deprecated. Use JAVA_OPTS to provide the`-Xms` option, for example, JAVA_OPTS=-Xms256m 7.2. JVM garbage collection settings The EAP image for OpenShift includes settings for both garbage collection and garbage collection logging Garbage Collection Settings -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:+ExitOnOutOfMemoryError Garbage Collection Logging Settings -Xlog:gc*:file=/opt/server/standalone/log/gc.log:time,uptimemillis:filecount=5,filesize=3M 7.3. JVM environment variables Use these environment variables to configure the JVM in the EAP for OpenShift image. Table 7.1. JVM Environment Variables Variable Name Example Default Value JVM Settings Description JAVA_OPTS -verbose:class No default Multiple JVM options to pass to the java command. Use JAVA_OPTS_APPEND to configure additional JVM settings. If you use JAVA_OPTS , some unconfigurable defaults are not added to the server JVM settings. You must explicitly add these settings. Using JAVA_OPTS disables certain settings added by default by the container scripts. Disabled settings include: -XX:MetaspaceSize=96M -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=jdk.nashorn.api,com.sun.crypto.provider -Djava.awt.headless=true Add these defaults if you use JAVA_OPTS to configure additional settings. JAVA_OPTS_APPEND -Dsome.property=value No default Multiple User-specified Java options to append to generated options in JAVA_OPTS . JAVA_MAX_MEM_RATIO 50 80 -Xmx Use this variable when the -Xmx option is not specified in JAVA_OPTS . The value of this variable is used to calculate the default maximum heap memory size based on the restrictions of the container. If this variable is used in a container without a memory constraint, the variable has no effect. If this variable is used in a container that does have a memory constraint, the value of -Xmx is set to the specified ratio of the container's available memory. The default value, 50 means that 50% of the available memory is used as an upper boundary. To skip calculation of maximum memory, set the value of this variable to 0 . No -Xmx option will be added to JAVA_OPTS . JAVA_INITIAL_MEM_RATIO 25 -Xms -Xms Use this variable when the -Xms option is not specified in JAVA_OPTS . The value of this variable is used to calculate the default initial heap memory size based on the maximum heap memory. If this variable is used in a container without a memory constraint, the variable has no effect. If this variable is used in a container that does have a memory constraint, the value of -Xms is set to the specified ratio of the -Xmx memory. The default value, 25 means that 25% of the maximum memory is used as the initial heap size. To skip calculation of initial memory, set the value of this variable to 0 . No -Xms option will be added to JAVA_OPTS . JAVA_MAX_INITIAL_MEM 4096 4096 -Xms JAVA_MAX_INITIAL_MEM environment variable is now deprecated, use JAVA_OPTS to provide -Xms option. For example, JAVA_OPTS=-Xms256m JAVA_DIAGNOSTICS true false (disabled) -Xlog:gc:utctime -XX:NativeMemoryTracking=summary Set the value of this variable to true to include diagnostic information in standard output when events occur. If this variable is defined as true in an environment where JAVA_DIAGNOSTICS has already been defined as true , diagnostics are still included. DEBUG true false -agentlib:jdwp=transport=dt_socket,address=USDDEBUG_PORT,server=y,suspend=n Enables remote debugging. DEBUG_PORT 8787 8787 -agentlib:jdwp=transport=dt_socket,address=USDDEBUG_PORT,server=y,suspend=n Specifies the port used for debugging. GC_MIN_HEAP_FREE_RATIO 20 10 -XX:MinHeapFreeRatio Minimum percentage of heap free after garbage collection to avoid expansion. GC_MAX_HEAP_FREE_RATIO 40 20 -XX:MaxHeapFreeRatio Maximum percentage of heap free after garbage collection to avoid shrinking. GC_TIME_RATIO 4 4 -XX:GCTimeRatio Specifies the ratio of the time spent outside of garbage collection (for example, time spent in application execution) to the time spent in garbage collection. GC_ADAPTIVE_SIZE_POLICY_WEIGHT 90 90 -XX:AdaptiveSizePolicyWeight The weighting given to the current garbage collection time versus the garbage collection times. GC_METASPACE_SIZE 20 96 -XX:MetaspaceSize The initial metaspace size. GC_MAX_METASPACE_SIZE 100 No default -XX:MaxMetaspaceSize The maximum metaspace size. GC_CONTAINER_OPTIONS -XX:+UserG1GC -XX:-UseParallelGC -XX:-UseParallelGC Specifies the Java garbage collection to use. The value of the variable is specified by using the Java Runtime Environment (JRE) command-line options. The specified JRE command overrides the default. The following environment variables are deprecated: JAVA_OPTIONS : Use JAVA_OPTS . INITIAL_HEAP_PERCENT : Use JAVA_INITIAL_MEM_RATIO . CONTAINER_HEAP_PERCENT : Use JAVA_MAX_MEM_RATIO . 7.4. Default datasource The datasource ExampleDS is not available in JBoss EAP 8.0. Some quickstarts require this datasource: cmt thread-racing Applications developed by customers might also require the ExampleDS datasource. If you need the default datasource, use the ENABLE_GENERATE_DEFAULT_DATASOURCE environment variable to include it when provisioning a JBoss EAP server. Note This environment variable works only when cloud-default-config galleon layer is used.

Commands:
ENABLE_GENERATE_DEFAULT_DATASOURCE=true