shaonan666 opened a new issue, #3569:
URL: https://github.com/apache/logging-log4j2/issues/3569

   ## Description
   
   I am using Log4j2 in my project and recently upgraded from version 2.23.1 to 
2.24.3. The application employs an asynchronous logging strategy with Disruptor 
version 3.4.3. Below is the relevant configuration:
   - 
`log4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector`
   - 
`log4j2.asyncQueueFullPolicy=org.apache.logging.log4j.core.async.DiscardingAsyncQueueFullPolicy`
   - `log4j2.discardThreshold=ERROR`
   - `log4j2.asyncLoggerWaitStrategy=Yield`
   - `log4j2.asyncLoggerRingBufferSize=1048576`
   
   The logging frequency in my application is relatively low, averaging about 
10 log entries per second. When using version 2.23.1, memory usage remained 
stable based on monitoring data . However, after upgrading to 2.24.3, I 
observed a gradual increase in memory usage over time, which eventually 
stabilizes at a fixed threshold.
   ![Figure 
1](https://github.com/user-attachments/assets/a316f1a6-ce6a-419c-a754-6bf2aec9f721)
   
   This behavior differs significantly from what I experienced with 2.23.1. 
Through heap dump analysis at different time intervals, I confirmed that the 
memory growth is primarily associated with `RingBufferLogEvent` objects within 
Log4j2’s RingBuffer implementation, with the RingBuffer’s memory footprint 
consistently increasing over time. 
   
   
![Image](https://github.com/user-attachments/assets/54e112ef-35f8-4f94-8ecc-cd4d2c05a0f4)
   
   
![Image](https://github.com/user-attachments/assets/102e503e-94de-496f-a24e-067526797dbd)
   
   
![Image](https://github.com/user-attachments/assets/4ed5c638-e571-4737-9802-0b17d5cdf0eb)
   
   I noticed that the 2.24.3 release includes several changes related to memory 
management. Could any of these changes, particularly those affecting the 
RingBuffer or `RingBufferLogEvent`, explain the behavior I am observing? 
   
   If additional details are needed, please let me know, and I’d be happy to 
provide them. 
   
   ## Environment
   - **Log4j2 Version**: 2.24.3 (upgraded from 2.23.1)
   - **Disruptor Version**: 3.4.3
   - **JVM**: Zing24.08.101.0+1 (build 21.0.4.0.101+1-LTS)
   - **Logging Frequency**: ~10 logs/second
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to