6 Best Practices for Optimizing JBoss EAP 7.x Performance
Tags: jboss, enterprise, eap
Published: 2023-01-11 05:12:10

The JBoss Enterprise Application Platform (JBoss EAP) is a reliable and stable Java EE-based application server runtime platform from Red Hat. It is subscription-based/open-source, and usable on any operating system that supports Java. JBoss EAP is part of Red Hat’s Enterprise Middleware portfolio and is perfect for building, deploying, and hosting highly-transactional Java applications and services.

The latest stable versions are JBoss EAP 7.x and here are the top 6 secrets our JBoss experts swear by to get the maximum ROI from your deployment.

1. Setting a fixed Heap size
Optimal application server memory settings depend on the applications deployed, the number of users, the virtual or physical host on which the installation resides, and the services running on the host.

It is recommended to set the Heap size to a minimum of 4GB and a maximum of half of your RAM since beyond that it can lead to performance issues. The server also plays a crucial role in this decision. For example, if the server contains 64GB of RAM, you can set the minimum Xms to 4GB and the maximum Xms to 32 GB.

2. Configuring log rotation
You can set the number of backups that the periodic rotating file handler creates. This handler is a combination of the size-rotating-file-handler and the periodic-rotating-file-handler. When being rotated by both (size and period), the limit is only on the size part, within the current time period, as period takes precedence and the size is applied to the period. Once it rotates to a different date, it ignores the previous ones and has a new limit for the new period. The Periodic Size Rotating File Handler will rotate when the pre-set log file size is reached or after a pre-set time.

The time is determined by the suffix used, for example, “.yyyy-MM-dd” would rotate every day and “.yyyy-MM-dd_HH:mm” would rotate every minute. The suffix string should be in a format which can be understood by java.text.SimpleDateFormat

3. Troubleshooting with JAVA Heap dump
A Java dump is a snapshot of the JVM itself, created at a specific point in time. Generating and analysing dump files can be useful for diagnosing and troubleshooting problems in Java applications. Depending on which JDK is in use, there are different ways to generate and parse a Java repository for the JBoss EAP process. You can use the following command to create an on-demand dump for JBoss EAP:

jcmd JAVA_PID GC.heap_dump -all=true FILENAME.hprof

This command creates a heap dump file in the HPROF format, which is usually located in EAP_HOME or EAP_HOME/bin.jcmd JAVA_PID GC.heap_dump -all=true FILENAME.hprof

4. Enabling Aggressive Optimizations
Using the AggressiveOpts JVM option can provide massive performance improvements to your environment. This setting enables Java performance optimization features that should be standard in future versions of Java. To enable AggressiveOpts, use the following JVM configuration:

XX:+AggressiveOpts

5. Choosing the right Garbage Collector
For standalone JBoss EAP servers running on OpenJDK or Oracle JDK, garbage collection logging is enabled by default. We recommend using the G1 garbage collector, which should be the standard starting with Java 9. The G1 garbage collector is generally superior to CMS and parallel garbage collectors in most cases.

6. Configuring Min and Max Pool Size
The min-pool-size property specifies the minimum connection pool size. If the minimum pool size is too small, this can increase latency when the first database command is executed, as new connections may need to be established. If the minimum pool size is too large, unnecessary connections to the data source or resource adapter will occur. The max-pool-size attribute specifies the maximum connection pool size. This is an important performance setting because it limits the number of active connections and thus the amount of concurrent activity. So, minimum and maximum pool sizes need to be carefully configured based on the unique needs of your environment.

This article was originally published on [our company blog](https://www.taashee.com/6-best-practices-for-optimizing-jboss-eap-7-x-performance/)