Configure the Java Virtual Machine (JVM) settings for an JBoss EAP managed domain.
| Resources | |
|---|---|
| Files |
/opt/domain
|
| Application URL | NA |
Outcomes
You should be able to configure the Java Virtual Machine (JVM) options used by Red Hat Enterprise Application Platform (JBoss EAP) servers running in a managed domain.
Use the following command to prepare the environment:
[student@workstation ~]$ lab start jvm-review
You can use either the JBoss EAP management console or the management CLI to achieve your objectives. Keep in mind that the management CLI is the preferred option in production environments.
A JBoss EAP administrator has set up a managed domain with two host controllers running on servera and serverb machines.
The domain controller runs on the workstation machine.
The domain and host configuration files are stored in the /opt/domain directory on all three machines.
![]() |
Instructions
Start the domain controller on the workstation machine.
Use /opt/domain as the jboss.domain.base.dir value.
The host file for the domain controller is named host-master.xml.
Note that the /opt/domain directory is owned by the jboss user, so you must start the domain controller using sudo -u jboss /opt/jboss-eap-7.4/bin/domain.sh ….
Start the two host controllers on the servera and the serverb machines.
Use /opt/domain as the jboss.domain.base.dir value.
The host file for the host controllers is host-slave.xml.
Note that the /opt/domain directory is owned by the jboss user, so you must start the host controller using ssh jboss@.server-name /opt/jboss-eap-7.4/bin/domain.sh …
You can safely ignore the following output:
WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.wildfly.extension.elytron.SSLDefinitions (jar:file:/opt/jboss-eap-7.4/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.4.11.CP/org/wildfly/extension/elytron/main/wildfly-elytron-integration-15.0.26.Final-redhat-00001.jar!/) to method com.sun.net.ssl.internal.ssl.Provider.isFIPS() WARNING: Please consider reporting this to the maintainers of org.wildfly.extension.elytron.SSLDefinitions WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release
Start the host controller on servera.
Open a new terminal window on the workstation machine and run the following command:
[student@workstation ~]$ssh -t jboss@servera /opt/jboss-eap-7.4/bin/domain.sh \-Djboss.domain.base.dir=/opt/domain/ \-Djboss.domain.master.address=172.25.250.9 \--host-config=host-slave.xml
Note the use of the -t option for the ssh command to allocate a pseudo-terminal.
You must use this option to properly propagate the signals that Ctrl+C sends to the remote machine.
Start the host controller on serverb.
Open a new terminal window on the workstation machine and run the following command:
[student@workstation ~]$ssh -t jboss@serverb /opt/jboss-eap-7.4/bin/domain.sh \-Djboss.domain.base.dir=/opt/domain/ \-Djboss.domain.master.address=172.25.250.9 \--host-config=host-slave.xml
Note the use of the -t option for the ssh command to allocate a pseudo-terminal.
You must use this option to properly propagate the signals that Ctrl+C sends to the remote machine.
Verify that both host controllers connect to the domain controller and form a managed domain.
Look at the console window where you started the domain controller and verify that both servera and serverb are registered as secondary controllers to the domain controller.
[Host Controller] 03:28:53,434 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.4.11.GA (WildFly Core 15.0.26.Final-redhat-00001) (Host Controller) started in 3622ms - Started 80 of 81 services (22 services are lazy, passive or on-demand) [Host Controller] 03:29:12,302 INFO [org.jboss.as.domain.controller] (Host Controller Service Threads - 37)WFLYHC0019: Registered remote slave host "servera", JBoss JBoss EAP 7.4.11.GA (WildFly 15.0.26.Final-redhat-00001) [Host Controller] 03:29:47,951 INFO [org.jboss.as.domain.controller] (Host Controller Service Threads - 37)WFLYHC0019: Registered remote slave host "serverb", JBoss JBoss EAP 7.4.11.GA (WildFly 15.0.26.Final-redhat-00001)
Configure the JVM options for the managed domain with the following specifications:
The minimum and maximum heap size of the default JVM on the host controller servera should be set to 512 MB.
For all the servers in the Group1 server group, create a new JVM configuration named group1-jvm.
Set the minimum JVM heap size to 512m (512 MB) and the maximum JVM heap size to 1024m (1 GB).
Enable the -XX:+UseShenandoahGC flag for this server group.
For the serverb.2 server, create a new JVM configuration named serverb.2-jvm that overrides any inherited settings.
Set the minimum and maximum JVM heap size to 1024m (1 GB).
Enable the -XX:+AggressiveOpts and -server flags for this server.
Leave all other JVM options at default values.
Ensure that all the servers in the managed domain are started with these settings and without any errors.
Verify that the JVM flags with which the servers are running, using the ps -aef command on the respective hosts.
When you start the managed domain at the beginning of the lab, all the servers are set to start automatically. Make sure you stop all the servers before you make changes to the JVM options in the managed domain.
Launch the management CLI to configure the JVM.
Stop the servers in the Group1 server group.
Stop the servers in the Group2 server group.
Configure the default JVM for the servera host controller to use a minimum amount of heap memory of 512 MB.
Configure the maximum amount of heap memory to 512MB.
Configure a JVM minimum amount of memory for server group Group1 of 512 MB, and a maximum amount of memory of 1024 MB.
Also, pass the -XX:+UseShenandoahGC as an option to the JVM .
Configure the JVM for serverb.2 server.
The minimum amount of memory for the server must be 1024 MB, and the maximum amount of memory to 1024 MB.
Also, pass the -XX:+AggressiveOpts and -server as parameters to the JVM .
Start the servers in Group1.
Start the servers in Group2.
In a different terminal window, verify the JVM options by using the ps command on each host.
[student@workstation ~]$ssh jboss@servera ps -efa|grep serverajboss 5593 5012 18 04:06 ? 00:00:13 /usr/lib/jvm/java-11-openjdk-11.0.14.1.1-6.el9.x86_64/bin/java -D[Server:servera.1] -D[pcid:200855209] -Xms512m -Xmx1024m -XX:+UseShenandoahGC-Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Djboss.domain.base.dir=/opt/domain/ ...output omitted... jboss 5758 5012 34 04:07 ? 00:00:14 /usr/lib/jvm/java-11-openjdk-11.0.14.1.1-6.el9.x86_64/bin/java -D[Server:servera.2] -D[pcid:976193559] -Xms64m -Xmx256m-Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Djboss.domain.base.dir=/opt/domain/ ...output omitted...
[student@workstation ~]$ssh jboss@serverb ps -efa|grep serverbjboss 5595 5013 5 04:06 ? 00:00:17 /usr/lib/jvm/java-11-openjdk-11.0.14.1.1-6.el9.x86_64/bin/java -D[Server:serverb.1] -D[pcid:1126635811] -Xms512m -Xmx1024m -XX:+UseShenandoahGC-Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Djboss.domain.base.dir=/opt/domain/ ...output omitted... jboss 5758 5013 5 04:07 ? 00:00:16 /usr/lib/jvm/java-11-openjdk-11.0.14.1.1-6.el9.x86_64/bin/java -D[Server:serverb.2] -D[pcid:709043458] -Xms1024m -Xmx1024m -XX:+AggressiveOpts -server -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Djboss.domain.base.dir=/opt/domain/ ...output omitted...
Shut down the servers, server groups, host controllers, and the entire managed domain by using the management CLI.
Stop all servers in Group1.
Stop the servers in Group2.
Shut down the host controller on servera.
Observe the console window of servera and verify that the host controller has been shut down.
Shut down the host controller on serverb.
Observe the console window of serverb and verify that the host controller has been shutdown.
Clean up and grading.
Press Ctrl+C to stop the domain controller.
Alternatively, you can shutdown the domain controller using the /host=master:shutdown() management CLI command.
Press Ctrl+C to exit the management CLI if you used the CLI in the lab.
Alternatively, you can exit the CLI by typing exit.
Run the following command from the workstation to grade the exercise:
[student@workstation ~]$ lab grade jvm-review