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

ASF subversion and git services commented on LOG4J2-3393:
---------------------------------------------------------

Commit 2ce13466115a0a5b4a466a814e36a3df2322ba09 in logging-log4j2's branch 
refs/heads/release-2.x from Volkan Yazıcı
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=2ce1346 ]

LOG4J2-3393 Improve JsonTemplateLayout performance. (#797)

* Replace hardcoded `8 * 1024` private value used for `byteBufferSize`
  in `StringBuilderEncoder()` ctor with
  `Constants.ENCODER_BYTE_BUFFER_SIZE`.

* Replace `StringBuilderEncoder` (uses an internal thread-local) and
  `LockingStringBuilderEncoder` (uses locks) with custom
  `JsonTemplateLayout.StringBuilderEncoder` class implementing
  `Encoder<StringBuilder>` interface. This was made possible by making
  `TextEncoderHelper.encodeText()` public. This makes use of JTL
  recyclers and provides better allocation performance. For instance,
  if JTL is configured with thread-local recycler, each encoding
  request will trigger a single TLA, whereas previously it needed to
  do two: one for `JsonTemplateLayout.Context` and
  `StringBuilderEncoder`.

* Add `CharSequence` specialization in `MessageResolver`.

* Improve troubleshooting experience by replacing lambdas with classes
  in `TemplateResolvers`.

* Improve locality and branching in `TemplateResolvers`.

* Improve JMH tests.

* Thanks so much to Carter Kozak for being the awesome sparring
  partner.

> JSON template layout performance regression
> -------------------------------------------
>
>                 Key: LOG4J2-3393
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3393
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: JsonTemplateLayout
>    Affects Versions: 2.17.1
>            Reporter: Volkan Yazici
>            Assignee: Volkan Yazici
>            Priority: Major
>
> JTL performance is used to be on par with \{{log4j2-ecs-layout}}, though this 
> is not the case anymore, there is a slight degradation. This story aims to 
> investigate what is going on and fix it.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to