[
https://issues.apache.org/jira/browse/LOG4J2-1120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Remko Popma resolved LOG4J2-1120.
---------------------------------
Resolution: Fixed
Avoiding lock acquisition fixed in commit 6b2cbc2d.
Replace ConcurrentHashMap with CopyOnWriteArraySet fixed in commit a48af4ec.
I created a separate ticket (LOG4J2-1121) to track the remaining change: is it
possible to remove waitForCompletion and associated fields (including the
counters).
> LoggerConfig performance improvements
> -------------------------------------
>
> Key: LOG4J2-1120
> URL: https://issues.apache.org/jira/browse/LOG4J2-1120
> Project: Log4j 2
> Issue Type: Improvement
> Components: Core
> Affects Versions: 2.3
> Reporter: Remko Popma
> Assignee: Remko Popma
> Fix For: 2.4
>
>
> As discussed on the mailing list, I can see several ways to improve the
> performance of the hot path in LoggerConfig.
> # Pulling up the {{shutdown.get()}} check into {{afterLogEvent()}} will avoid
> acquiring the shutdownLock unnecessarily - only acquiring the lock if a
> shutdown is actually in progress.
> # Another performance improvement can be made by changing the data structure
> that holds the AppenderControl objects from ConcurrentHashMap to
> CopyOnWriteArraySet. Modifications on this data structure are extremely rare,
> and the array-based collection has much better iteration performance.
> # Finally, since {{clearAppenders()}} is only called after all appenders have
> been stopped, {{waitForCompletion()}} may no longer be necessary (unless I am
> missing something here). If so, the {{shutdownLock}}, {{shutdown}} and
> {{counter}} fields can be removed. Not incrementing the atomic counters with
> every event in the hot path should give better performance.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]