Also, Javadocs should mention the "normal" part that Remko mentions.
Gary On May 9, 2016 5:38 AM, "Mikael Ståldal" <[email protected]> wrote: > I get the feeling that all this copying/cloning/building/serialization of > LogEvents is too complicated, and would need a major clean-up. > > On Mon, May 9, 2016 at 1:41 PM, Remko Popma (JIRA) <[email protected]> > wrote: > >> >> [ >> https://issues.apache.org/jira/browse/LOG4J2-1382?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15276248#comment-15276248 >> ] >> >> Remko Popma commented on LOG4J2-1382: >> ------------------------------------- >> >> Note that MutableLogEvent.createMemento() also calls getSource() but this >> is on purpose (and works this way for Log4jLogEvent as well). So this is >> not a problem and should not be changed. >> >> >> > Performance regression in RewriteAppender >> > ----------------------------------------- >> > >> > Key: LOG4J2-1382 >> > URL: https://issues.apache.org/jira/browse/LOG4J2-1382 >> > Project: Log4j 2 >> > Issue Type: Bug >> > Components: Appenders >> > Affects Versions: 2.6 >> > Reporter: Remko Popma >> > Assignee: Remko Popma >> > Fix For: 2.6 >> > >> > >> > While working on LOG4J2-1179, I ran into these benchmark results: >> > {code} >> > Benchmark Mode >> Samples Score Error Units >> > o.a.l.l.p.j.Log4j2AppenderComparisonBenchmark.appenderRewrite thrpt >> 5 44263670.008 ± 17389305.070 ops/s >> > o.a.l.l.p.j.Log4j2AppenderComparisonBenchmark.end2endRewrite thrpt >> 5 37254.554 ± 16440.919 ops/s >> > {code} >> > In plain English: directly calling RewriteAppender.append(LogEvent) can >> do 44 million ops/sec, but when calling rewriteLogger.debug(msg) to invoke >> a logger that calls this appender, all of a sudden throughput drops to 37 >> _thousand_ ops/sec. That's 1000x slower. Fishy... >> > Turns out that when rewriting the event we are now including caller >> location information (taking a snapshot of the stack and walking it). Ouch. >> > This is a regression caused by the garbage-free stuff. Rewriting the >> event makes a copy of the event and avoids calling LogEvent.getSource() >> only if the event is an instance of Log4jLogEvent, but now we are passing >> in MutableLogEvent. >> > The fix is to update Log4jLogEvent.Builder to also avoid calling >> getSource when copying from a MutableLogEvent. >> >> >> >> -- >> This message was sent by Atlassian JIRA >> (v6.3.4#6332) >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > > -- > [image: MagineTV] > > *Mikael Ståldal* > Senior software developer > > *Magine TV* > [email protected] > Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com > > Privileged and/or Confidential Information may be contained in this > message. If you are not the addressee indicated in this message > (or responsible for delivery of the message to such a person), you may not > copy or deliver this message to anyone. In such case, > you should destroy this message and kindly notify the sender by reply > email. >
