Troubleshooting performance issues for applications running on JBoss

2019november19

Once a web application is developed, we need an application server to deploy the application. A popular Java enterprise application server is JBoss from Red Hat. JBoss has a lot of out-of-the-box features such as security mechanisms, repositories and logging. However, there are some aspects to deploying an application on JBoss that require more developer involvement related to improving performance and scalability of the application. Below are some of the primary ways of achieving better performance while using the JBoss application server. Many of the considerations are also useful on other Java application servers.

JBoss Application Performance Monitor

Monitoring applications help to identify the health and performance of the application server. Monitoring tools can assist with checking the production log, constant application availability and performance, as well as generate alerts for poor performance when resources reach a threshold, identifying a long running thread. In addition, the tools offer deep insight into the JVM memory space, Heap memory utilization, garbage collection and JDBC transactions. All these are critical in tuning and optimizing performance.

Increase resources

Increasing resources allows the Memory and CPU of the machine to have improved performance, although it may not be cost effective, and therefore, less ideal as one of the choices in improving performance. This is helpful as a stopgap measure until the underlying performance issues are resolved.

Selecting the right Framework

Having the right development framework provides less run time. It is important to compare the resource consumption of each framework and their tradeoffs before selecting one for development.

Adding network devices such as Load Balancers (and SSL offload devices)

If there are multiple servers that run the application, a load balancer is critical. Even if the application is poor at scaling, a load balanced setup can improve the user experience without adding resources on the application servers. Load balancers can lead to significant improvement in performance because they prevent one server from being overloaded, while other servers are waiting due to traffic. An ideal load-balancer performs periodic health checks on the underlying application servers and takes poorly performing application servers out of the pool. Load balancers that do SSL offloads improve performance too.

Introduction of Application and Web Caching

Caching improves web application performance by providing the in-memory resources to the client. We can cache both dynamic and static containers of web applications by using different techniques (I will write a blog about this at a later point in time).  These include moving content closer to users, moving containers to faster machines or taking containers off overused machines. Application caching reduces the amount of calls to the database. Web caching reduces the amount of calls to the application servers by serving static pages, or static parts of pages.

Proper Logging

Logging is one of the ways to measure application performance.  However, excessive logging can result in a performance problem, so we must careful to introduce the right logging levels especially in the production environment.  While it is customary to have a debugging mode in the development environment, it would be excessive and resource consuming for production, and therefore, better to introduce the ERROR level for logging in Production.

Garbage Collection Overhead

Java garbage collection (GC) is the process by which Java programs automatically reclaim memory from the heap. When Java programs run on a JVM, objects are created on the heap—a portion of the system memory dedicated to the program. Eventually, some objects are no longer needed. The garbage collector finds these unused objects and deletes them to free up memory. The GC process itself consumes resources and excessive GC overhead may slow down an application. Consequently, we must pay attention for the Min and Max of the Heap size values in the Java command line options and tune it appropriately.  In addition, the GC collection times can also be tuned.

In summary, the ideal way to have a good performance application is to choose the right framework from the start, as well as to have the monitoring and logging mechanisms in place, to see the performance of the application real time and to take the appropriate measures based on the issue at hand.