JBoss - Java heap retention in org.apache.log4j.helpers.BoundedFIFO

Solution Verified - Updated

Environment

  • JBoss

Issue

  • java.lang.OutOfMemoryError: Java heap
  • Java heap inspection shows rentention in multiple instances of org.apache.log4j.helpers.BoundedFIFO.

Resolution

Replace AsyncAppender with FileAppender:

How do I replace the AsyncAppender with a FileAppender on JBoss?

Root Cause

Poor response times and throughput can be the result of using the AsyncAppender, which can lead to heap retention. The AsyncAppender does not always improve logging throughput. A significant number of CPU cycles are spent managing the bounded queue and synchronizing the dispatcher thread with various client threads. Logging each event will take a little longer to complete; however, appending those events will hopefully take place at times where other threads are idle, either waiting for new input to process or blocked on I/O intensive operations. Thus, I/O bound applications will benefit from asynchronous logging while CPU bound applications will not.

Diagnostic Steps

Components

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.