[
https://issues.apache.org/jira/browse/LOG4J2-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13562289#comment-13562289
]
Remko Popma commented on LOG4J2-151:
------------------------------------
One more comment on the merits of async logging, and then I'll stop, I promise!
:-)
Delegating logging to a separate thread *does* improve the throughput of the
application.
Example:
* business logic takes 50 us/event
* we log 10 messages per event
* syncronous logging takes 4 us/message
* async logging takes 150 nanos before call to Logger.log returns
Then with synchronous logging:
50 + (10 * 4) = 90 us/event gives
max throughput = 11,111 events/sec
With asynchronous logging:
* Business logic thread (t1): 50 + (10 * 0.150) = 51.5 us/event
max throughput of t1 = 19,417 events/sec
* Logging thread (t2): 10 * 4 = 40 us/event
max throughput of t2 = 25,000 events/sec
max throughput = min(t1, t2) = 19,417 events/sec
(Sorry for the many comments, apologies for taking so much of your time, hope
you still think this is valueable.)
> Please facilitate subclassing Logger and LoggerContext (in
> org.apache.logging.log4j.core)
> -----------------------------------------------------------------------------------------
>
> Key: LOG4J2-151
> URL: https://issues.apache.org/jira/browse/LOG4J2-151
> Project: Log4j 2
> Issue Type: New Feature
> Components: Core
> Affects Versions: 2.0-beta3
> Reporter: Remko Popma
> Attachments: FastLog4j.zip
>
>
> I would like to create a custom logger, while reusing the
> org.apache.logging.log4j.core.Logger functionality.
> The following two changes would make subclassing possible:
> * change visibility of method Logger$PrivateConfig#logEvent(LogEvent) (line
> 265) from protected to public
> * change visibility of method LoggerContext#newInstance(LoggerContext,
> String) (line 310) from private to protected
> My use case is that I want to create an asynchronous Logger for low latency
> logging.
> This custom logger hands off control to a separate thread as early as
> possible. In my case, AsynchAppender is not a good match for my requirements,
> as with that approach (a) the logging call still needs to flow down the
> hierarchy to the appender, doing synchronization and creating objects at
> various points on the way, and (b) when serializing the LogEvent, the
> getSource() method is always called, which is expensive.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]