[ 
https://issues.apache.org/jira/browse/LOG4J2-2795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17052407#comment-17052407
 ] 

Ralph Goers commented on LOG4J2-2795:
-------------------------------------

I modified loading the plugins so that the classes are not loaded when the 
plugins definitions are read and are instead loaded when the plugin system 
actually needs the class.  The cost of calling collectPlugins() is now greatly 
reduced. but the overall startup time didn't really change much from the 
previous 3.0.0 implementation I tested.  Compared to 2.13.2-SNAPSHOT the 
overall startup has been cut in half. Creating the PatternParser is slightly 
better but still spends 80 ms in PluginType.getPluginClass(), which is where 
the class loading was moved to, so essentially collectPlugins went from 300-400 
ms in the prior test to 130-150 ms with this implementation.


||Logger Count||2.13.2-SNAPSHOT Elapsed||2.13.2-SNAPSHOT CollectPlugins 
||3.0.0-SNAPSHOT Elapsed||3.0.0-SNAPSHOT Collect Plugins||3.0.0-SNAPSHOT Lazy 
Elapsed||3.0.0-SNAPSHOT CollectPlugins||
|1|2,654 ms| 1,315 ms|864 ms|350 ms|1,175 ms|59 ms|
|100| 1,927 ms| 969 ms|1,206 ms|375 ms|1,152 ms|52 ms|
|1000| 2,339 ms| 1,259 ms|1,703 ms|468 ms|1,429 ms|67 ms|

> Make LogManager/LoggerContext creation time reasonable
> ------------------------------------------------------
>
>                 Key: LOG4J2-2795
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2795
>             Project: Log4j 2
>          Issue Type: Task
>          Components: Core
>    Affects Versions: 2.13.0
>            Reporter: Romain Manni-Bucau
>            Priority: Major
>         Attachments: log4j2.png
>
>
> Currently (2.13), LogManager.getLogger("xxx") takes ~600ms on a cold JVM by 
> itself.
> For a logging framework it is likely way too much (by comparison a CDI test 
> with classpath scanning takes ~50ms).
>  
> This ticket is about trying to be faster (maybe by removing java 
> serialization usage and reducing registry usage + reflection of plugins by 
> generating java code?).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to