[
https://issues.apache.org/jira/browse/KAFKA-1351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14099963#comment-14099963
]
Viktor Taranenko commented on KAFKA-1351:
-----------------------------------------
I believe loggers already do lots of optimisations for string concatenation.
I see kafka.util.Logging duplicates that functionality a lot
So when you write
{code}
logger.debug("Entry number: {} is {}", i, entry[i]);
{code}
it doesn't do any concatenation if debug level is not enabled (at least in
modern loggers).
http://logging.apache.org/log4j/2.x/performance.html
If logging is really a bottleneck in Kafka, you might consider upgrading
dependency to [log4j2|http://logging.apache.org/log4j/2.x/], which even has
async logging feature based on LMAX Disruptor. I has the similar bindings to
slf4j-api which Kafka currently use. Shouldn't be painful.
Consider http://logging.apache.org/log4j/2.x/manual/async.html
> String.format is very expensive in Scala
> ----------------------------------------
>
> Key: KAFKA-1351
> URL: https://issues.apache.org/jira/browse/KAFKA-1351
> Project: Kafka
> Issue Type: Bug
> Components: core
> Affects Versions: 0.7.2, 0.8.0, 0.8.1
> Reporter: Neha Narkhede
> Labels: newbie
> Fix For: 0.8.2
>
> Attachments: KAFKA-1351.patch, KAFKA-1351_2014-04-07_18:02:18.patch,
> KAFKA-1351_2014-04-09_15:40:11.patch
>
>
> As found in KAFKA-1350, logging is causing significant overhead in the
> performance of a Kafka server. There are several info statements that use
> String.format which is particularly expensive. We should investigate adding
> our own version of String.format that merely uses string concatenation under
> the covers.
--
This message was sent by Atlassian JIRA
(v6.2#6252)