lucasbru opened a new pull request, #21494: URL: https://github.com/apache/kafka/pull/21494
As reported in https://github.com/apache/kafka/pull/19138, `LoggerFactory.getLogger()` is expensive with log4j2. `InternalTopicManager.configureTopics` and the helper classes it instantiates (`RepartitionTopics`, `CopartitionedTopicsEnforcer`, `ChangelogTopics`) each called `logContext.logger()` on every invocation, creating 4 new loggers per call. Since `configureTopics` is called on the streams group heartbeat path, this adds unnecessary CPU overhead. This changes all four classes to accept a pre-created `Logger` instead of a `LogContext`, so that the caller's existing logger is reused rather than creating new loggers on every `configureTopics` call. A simple microbenchmark shows that with log4j2, `logContext.logger()` costs ~4 microseconds per call (~10 microseconds for the 4 loggers created per `configureTopics` invocation), compared to ~0.14 microseconds with the NOP logger. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
