JBoss Enterprise Application Platform leverages a Java Virtual Machine to run its standalone server and host its applications. As we deploy our applications and leverage JBoss, we want to ensure our apps have optimal performance, and a portion of that lies in optimizing the JVM itself. In this hands-on lab, we explore a number of Java options we can set to ensure our JVM it running the best it can.
Successfully complete this lab by achieving the following learning objectives:
- Check for Existing JVM Settings
See if there are any existing Java settings to consider:
We can now set our options by using
exporton the CLI, or via the console. Let’s switch to the console by going to
PUBLICIP:9990and logging in as the
adminuser with the password
- Set a Fixed Heap Size
Navigate to the Configuration section of the HAL Management Console, then select System Properties.
Click Add on the right-hand side of the table.
Set the Name filed to
JAVA_OPTSand the Value field to
- Enable the G1 Garbage Collector and Aggressive Optimizations
The additional options we need also need to be set under the
JAVA_OPTSfrom the table and click Edit. Enable both the garbage collection and aggressive optimizations. The full expression should be:
-Xms1024M -Xmx1024M -XX:+UseG1GC -XX:+AggressiveOpts
- Confirm the Changes
Back on the CLI, open the standalone configuration file and search for
JAVA_OPTSto confirm the changes:
Exit the CLI with
Restart the server:
sudo systemctl restart jboss-eap-rhel