Chapter 9. Configuring JVM Settings
Configuration of Java Virtual Machine (JVM) settings is different for a standalone JBoss EAP server, or a JBoss EAP server in a managed domain.
For a standalone JBoss EAP server instance, the server startup processes pass JVM settings to the JBoss EAP server at startup. These can be declared from the command line before launching JBoss EAP, or using the System Properties screen in the management console.
In a managed domain, JVM settings are declared in the
domain.xml configuration files, and can be configured at host, server group, or server levels.
System properties must be configured in
JAVA_OPTS to be used by JBoss EAP modules (such as the logging manager) during startup.
9.1. Configuring JVM Settings for a Standalone Server
JVM settings for standalone JBoss EAP server instances can be declared at runtime by setting the
JAVA_OPTS environment variable before starting the server.
An example of setting the
JAVA_OPTS environment variable on Linux is shown below.
$ export JAVA_OPTS="-Xmx1024M"
The same setting can be used in a Microsoft Windows environment:
Alternatively, JVM settings can be added to the
standalone.conf file in the
EAP_HOME/bin folder, which contains examples of options to pass to the JVM.
JAVA_OPTS environment variable will override the default values from
standalone.conf, which may cause JBoss EAP startup issues.
9.2. Configuring JVM Settings for a Managed Domain
In a JBoss EAP managed domain, you can define JVM settings at multiple levels. You can define custom JVM settings on a particular host, and then apply those settings to server groups, or to individual server instances.
By default, server groups and individual servers will inherit the JVM settings from their parent, but you can choose to override JVM settings at each level.
The JVM settings in
domain.conf are applied to the Java process of the JBoss EAP host controller, and not the individual JBoss EAP server instances controlled by that host controller.
9.2.1. Defining JVM Settings on a Host Controller
You can define JVM settings on a host controller, and apply those settings to server groups or individual servers. JBoss EAP comes with a
default JVM setting, but the following management CLI command demonstrates creating a new JVM setting named
production_jvm with some custom JVM settings and options.
/host=HOST_NAME/jvm=production_jvm:add( heap-size=2048m, max-heap-size=2048m, max-permgen-size=512m, stack-size=1024k, jvm-options=["-XX:-UseParallelGC"] )
You can also create and edit JVM settings in the JBoss EAP management console by selecting the Runtime tab, selecting Hosts, and clicking JVM on the host you want to edit.
These settings are stored in the within the
<jvm> tag in
9.2.2. Applying JVM Settings to a Server Group
When creating a server group, you can specify a JVM configuration that all servers in the group will use. The following management CLI commands demonstrate creating a server group name
groupA that uses the
production_jvm JVM settings that were shown in the previous example.
/server-group=groupA:add(profile=default, socket-binding-group=standard-sockets) /server-group=groupA/jvm=production_jvm:add()
All servers in the server group will inherit JVM settings from
You can also override specific JVM settings at the server group level. For example, to set a different heap size, you can use the following command:
After applying the above command, the server group
groupA will inherit the JVM settings from
production_jvm, except for the heap size which has an overridden value of
You can also edit server group JVM settings in the JBoss EAP management console by selecting the Runtime tab, selecting Server Groups, and clicking View for the server group you want to edit.
These settings for a server group are stored in
9.2.3. Applying JVM Settings to an Individual Server
By default, an individual JBoss EAP server instance will inherit the JVM settings of the server group it belongs to. However, you can choose to override the inherited settings with another complete JVM setting definition from the host controller, or choose to override specific JVM settings.
For example, the following command overrides the JVM definition of the server group in the previous example, and sets the JVM settings for
server-one to the
default JVM definition:
Also, similar to server groups, you can override specific JVM settings at the server level. For example, to set a different heap size, you can use the following command:
You can also edit server JVM settings in the JBoss EAP management console by selecting the Runtime tab, selecting Hosts, selecting the relevant host. Then select the relevant server, and click View for the server you want to edit.
These settings for an individual server are stored in
9.3. Displaying the JVM Status
You can view the status of JVM resources, such as heap and thread usage, for standalone or managed domain servers from the management console. While statistics are not displayed in real time, you can click Refresh Results to provide an up-to-date overview of JVM resources.
To display the JVM status for a standalone JBoss EAP server:
- Select the Runtime tab, and then select Standalone Server. In the Monitor column, select JVM and click View.
To display the JVM status for a JBoss EAP server in a managed domain:
- Select the Runtime tab, and then select the server group and server that you want to view. In the Monitor column, select JVM and click View.
This shows the following heap usage information:
- The maximum amount of memory that can be used for memory management.
- The amount of used memory.
- The amount of memory that is committed for the Java Virtual Machine to use.
Other information, such as JVM uptime and thread usage, is also available.
9.4. Specifying 32 or 64-bit JVM Architecture
In some environments, such as Hewlett-Packard HP-UX and Solaris, the
-d64 switch is used to specify whether to run in a 32-bit or 64-bit JVM. The default is 32-bit if neither option is indicated.
Specifying 64-Bit Architecture for a Standalone Server
Add the following line to append the
Specifying 64-Bit Architecture for a Managed Domain
When running a managed domain, you can specify the 64-bit environment for host and process controllers in addition to server instances.
Set the host and process controllers to run in the 64-bit JVM.
Add the following line to append the
JAVA_OPTS. Ensure that this is inserted before where
Example JVM options in
# # Specify options to pass to the Java VM. # if [ "x$JAVA_OPTS" = "x" ]; then JAVA_OPTS="-Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true" JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true" JAVA_OPTS="$JAVA_OPTS -Djboss.modules.policy-permissions=true" JAVA_OPTS="$JAVA_OPTS -d64" else echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS" fi
Set the server instances to run in the 64-bit JVM.
-d64as a JVM option in your appropriate JVM configuration. The command below shows it being added to the