You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Kirk True (Jira)" <ji...@apache.org> on 2024/06/17 21:30:00 UTC
[jira] [Updated] (KAFKA-16942) Use ConcurrentHashMap in RecordAccumulator#nodeStats
[ https://issues.apache.org/jira/browse/KAFKA-16942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kirk True updated KAFKA-16942:
------------------------------
Component/s: producer
> Use ConcurrentHashMap in RecordAccumulator#nodeStats
> ----------------------------------------------------
>
> Key: KAFKA-16942
> URL: https://issues.apache.org/jira/browse/KAFKA-16942
> Project: Kafka
> Issue Type: Improvement
> Components: clients, producer
> Reporter: Kuan Po Tseng
> Assignee: Kuan Po Tseng
> Priority: Major
>
> per discussed in [https://github.com/apache/kafka/pull/16231#discussion_r1635345881]
> Through the ConcurrentMapBenchmark, we observed that in scenarios where write operations (i.e., computeIfAbsent) constitute 10%, the get performance of CopyOnWriteMap is lower compared to ConcurrentHashMap. However, when iterating over entrySet and values, CopyOnWriteMap performs better than ConcurrentHashMap.
> In RecordAccumulator#nodeStats, the computeIfAbsent method is rarely triggered, and we only use the get method to read data. Therefore, switching to ConcurrentHashMap would gain better performance.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)