19 June 2019

Contention RollingFileManager.checkRollover()

Contention at: org.apache.logging.log4j.core.appender.rolling.RollingFileManager.checkRollover()

This is a problem with high concurrency, and it works as designed. The file system (I/O) doesn't have  enough performance as required.

The synchronized makes BLOCKED some Java monitor when trying to acquire the resource.
 
/**
 * Determines if a rollover should occur.
 * @param event The LogEvent.
 */
public synchronized void checkRollover(final LogEvent event) {
    if (triggeringPolicy.isTriggeringEvent(event)) {
        rollover();
    }
}

The solution as mentioned above is to move to Async logging.
https://logging.apache.org/log4j/2.x/manual/async.html

No comments :

My Blog List

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.