In a Red Hat JBoss Enterprise Application Platform (JBoss EAP) managed domain, the host controller is responsible for starting the Java Virtual Machine (JVM) process for each server in the managed domain. The JVM options for each individual server can be configured at three different levels:
The <jvm> section within host.xml
The <server-group> section in domain.xml
The <server> section within host.xml
Similar to the $JBOSS_HOME/bin/standalone.conf file for a standalone server, there is a domain.conf in the same directory.
The JVM memory options in domain.conf refer to the memory given to the Java process that is running the host controller, not the individual JBoss EAP servers within that host.
A JVM memory option that displays at a lower level, closer to the server level, overrides any inherited option from a higher level. More specifically:
A JVM memory option in the server group level of domain.xml overrides any options inherited from the corresponding <jvm> definition in host.xml.
A JVM memory option in the server level of host.xml overrides any options inherited from the <jvm> section, and also the server group level.
JBoss EAP uses the <jvm> configuration tag for defining different options for JVM processes.
You can define <jvm> at all three configuration levels by using the management console or the management CLI.
You can define a <jvm> at the host controller level in the host.xml file, within the <jvms> tag.
A sample <jvm> definition in the host.xml looks like the following snippet:
<jvms>
<jvm name="small_jvm">
<heap size="64m" max-size="128m"/>
</jvm>
<jvm name="production_jvm">
<heap size="2048m" max-size="2048m"/>
<jvm-options>
<option value="-server"/>
</jvm-options>
</jvm>
</jvms>The corresponding CLI command to define the JVMs is as follows:
/host=servera/jvm=small_jvm:add(heap-size=64m,max-heap-size=128m)
/host=servera/jvm=production_jvm:add(
heap-size=2048m,
max-heap-size=2048m,
jvm-options=["-server"]
)In the preceding definition, the small_jvm JVM has a minimum heap size of 64 MB and a maximum heap size of 128 MB.
The production_jvm JVM has minimum and maximum heap size of 2 GB and an option named -server is set for the JVM.
You can pass multiple JVM options in this manner.
After you have defined a <jvm> tag, you can reference the tag from both server-group and server definitions.
The specific settings of a named <jvm> can be overridden by the server-group and server
definitions.
A server-group definition in the domain.xml file uses the <jvm> tag to specify which <jvm> definition to use.
For example, the following server-group definition in domain.xml uses a JVM called production_jvm:
<server-group name="groupA" profile="default">
<jvm name="production_jvm"/>
<socket-binding-group ref="standard-sockets"/>
</server-group>The corresponding CLI command is as follows:
/server-group=groupA:add \
(profile=default,socket-binding-group=standard-sockets) \
/server-group=groupA/jvm=production_jvm:add()Any server in the groupA server group inherits the JVM options from the production_jvm.
A server-group can override the settings of the <jvm> definition.
For example, the following server-group definition changes the heap size of the production_jvm:
<server-group name="groupB" profile="default">
<jvm name="production_jvm">
<heap size="1024m" max-size="1024m"/>
</jvm>
<socket-binding-group ref="standard-sockets"/>
</server-group>Any server in the groupB server group has a minimum and maximum heap size of 1024MB, and its other JVM settings are inherited from the production_jvm definition.
A new JVM configuration can be defined at the server group level without inheriting any settings from a JVM defined at the host controller level.
This new JVM can be referred to at the server level and can be overridden.
For example, a new JVM called groupa-jvm can be defined at the server-group level:
/server-group=groupA/jvm=groupa-jvm:add \ (heap-size=512m,max-heap-size=512mm,jvm-options=["-server"])
You can configure the JVM options at the server level, within the <server> definition in the host.xml file.
A new <jvm> can be defined , and it can also override any JVM settings that the server inherits from either its server group definition, or its jvm definition at the host controller level.
A sample definition at the server level is as follows:
<server name="test_server" group="groupB" auto-start="true">
<socket-binding-group ref="standard-sockets" port-offset="300"/>
<jvm name="production_jvm">
<heap size="256m"/>
</jvm>
</server>In the previous example, test_server uses the settings from production_jvm, except for the initial heap size, which is 256MB instead of the 1024MB defined in the groupB server group.
You can also define a new JVM configuration at the server level without inheriting any settings from a JVM defined at the host controller level or the server group level.
For example, a new JVM called serverX-jvm can be defined at the server level:
/host=host3/server-config=serverX \ /jvm=serverX-jvm:add \ (heap-size=512m,max-heap-size=1500m, \ jvm-options=["-server","-XX:ParallelGCThreads=4"])
For more information about configuring JVM options in JBoss EAP domain mode, refer to the Configuring JVM Settings section in the Configuration Guide in the Red Hat JBoss EAP documentation at https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.4/html-single/configuration_guide/index#configuring_jvm_settings